Skip to content

Instantly share code, notes, and snippets.

@kvark
Last active August 10, 2018 01:56
Show Gist options
  • Save kvark/06c96ef8081e2239955b to your computer and use it in GitHub Desktop.
Save kvark/06c96ef8081e2239955b to your computer and use it in GitHub Desktop.

Revisions

  1. kvark revised this gist Aug 10, 2018. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion RustVsC++.md
    Original file line number Diff line number Diff line change
    @@ -3,4 +3,7 @@ Reasons why Rust can be faster than C++:
    * one less jump on virtual functions due to traits ([Runtime polymorphism](https://github.com/rust-lang/rust/wiki/Rust-for-CXX-programmers#runtime-polymorphism))
    * undefined struct layout
    * reference counting (```Rc<T>```) is lock-free because of being task-local
    * allocator model: rust provides hints and could inline calls to ```jemalloc``` ([issue](https://github.com/rust-lang/rust/issues/14151), [RFC](https://github.com/rust-lang/rfcs/pull/39))
    * allocator model: rust provides hints and could inline calls to ```jemalloc``` ([issue](https://github.com/rust-lang/rust/issues/14151), [RFC](https://github.com/rust-lang/rfcs/pull/39))


    > It's worth noting that since Rust restricts pointers more than C does, the ordering restrictions on pointers could be relaxed. This hasn't been implemented in LLVM yet since most of the optimization work is based on leveraging the rules of C and C-family languages. Even if they did implement relaxations on the reordering rules, however, storing data in registers will still be easier to optimize.
  2. kvark revised this gist Jun 18, 2014. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions RustVsC++.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    Reasons why Rust can be faster than C++:
    * aliasing information available to compiler (automatic ```__restrict```)
    * one less jump on virtual functions due to traits ([Runtime polymorphism][https://github.com/rust-lang/rust/wiki/Rust-for-CXX-programmers#runtime-polymorphism])
    * one less jump on virtual functions due to traits ([Runtime polymorphism](https://github.com/rust-lang/rust/wiki/Rust-for-CXX-programmers#runtime-polymorphism))
    * undefined struct layout
    * reference counting (```Rc<T>```) is lock-free because of being task-local
    * allocator model: rust provides hints and could inline calls to ```jemalloc``` ([issue][https://github.com/rust-lang/rust/issues/14151], [RFC][https://github.com/rust-lang/rfcs/pull/39])
    * allocator model: rust provides hints and could inline calls to ```jemalloc``` ([issue](https://github.com/rust-lang/rust/issues/14151), [RFC](https://github.com/rust-lang/rfcs/pull/39))
  3. kvark revised this gist Jun 18, 2014. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions RustVsC++.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    Reasons why Rust can be faster than C++:
    * aliasing information available to compiler (automatic ```__restrict```)
    * one less jump on virtual functions due to traits (https://github.com/rust-lang/rust/wiki/Rust-for-CXX-programmers#runtime-polymorphism)
    * one less jump on virtual functions due to traits ([Runtime polymorphism][https://github.com/rust-lang/rust/wiki/Rust-for-CXX-programmers#runtime-polymorphism])
    * undefined struct layout
    * reference counting (```Rc<T>```) is lock-free because of being task-local
    * allocator model: rust provides hints and could inline calls to ```jemalloc```
    * allocator model: rust provides hints and could inline calls to ```jemalloc``` ([issue][https://github.com/rust-lang/rust/issues/14151], [RFC][https://github.com/rust-lang/rfcs/pull/39])
  4. kvark revised this gist Jun 18, 2014. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions RustVsC++.md
    Original file line number Diff line number Diff line change
    @@ -3,3 +3,4 @@ Reasons why Rust can be faster than C++:
    * one less jump on virtual functions due to traits (https://github.com/rust-lang/rust/wiki/Rust-for-CXX-programmers#runtime-polymorphism)
    * undefined struct layout
    * reference counting (```Rc<T>```) is lock-free because of being task-local
    * allocator model: rust provides hints and could inline calls to ```jemalloc```
  5. kvark revised this gist Jun 18, 2014. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions RustVsC++.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    Reasons why Rust can be faster than C++:
    * aliasing information available to compiler
    * aliasing information available to compiler (automatic ```__restrict```)
    * one less jump on virtual functions due to traits (https://github.com/rust-lang/rust/wiki/Rust-for-CXX-programmers#runtime-polymorphism)
    * undefined struct layout
    * Reference counting (```Rc<T>```) is lock-free because of being task-local
    * reference counting (```Rc<T>```) is lock-free because of being task-local
  6. kvark revised this gist Jun 18, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion RustVsC++.md
    Original file line number Diff line number Diff line change
    @@ -2,4 +2,4 @@ Reasons why Rust can be faster than C++:
    * aliasing information available to compiler
    * one less jump on virtual functions due to traits (https://github.com/rust-lang/rust/wiki/Rust-for-CXX-programmers#runtime-polymorphism)
    * undefined struct layout
    * Rc<T> is lock-free because of being task-local
    * Reference counting (```Rc<T>```) is lock-free because of being task-local
  7. kvark revised this gist Jun 18, 2014. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions RustVsC++.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,5 @@
    Reasons why Rust can be faster than C++:
    * aliasing information available to compiler
    * one less jump on virtual functions due to traits (https://github.com/rust-lang/rust/wiki/Rust-for-CXX-programmers#runtime-polymorphism)
    * undefined struct layout
    * Rc<T> is lock-free because of being task-local
  8. kvark revised this gist Jun 18, 2014. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions RustVsC++.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,4 @@
    Reasons why Rust can be faster than C++:
    * aliasing information available to compiler
    * undefined struct layout
    * Rc<T> is lock-free because of being task-local
  9. kvark created this gist Jun 18, 2014.
    3 changes: 3 additions & 0 deletions RustVsC++.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    Reasons why Rust can be faster than C++:
    * aliasing information available to compiler
    * Rc<T> is lock-free because of being task-local