News for hackers. Stuff that matters.
Re:Rust Priorities after 1.0 by andrewchambers on Thursday April 16, 2015 @11:14PM (#9392081)
The upper performance for garbage collected languages (and rust) is potentially higher than C. The reasons are non aliased pointers allow more aggressive optimization, and batched garbage collection plus memory compaction can perform better than regular mallocs.

Rust still has these advantages though, time will tell. Does rust have a way to avoid bounds checks on arrays? I suppose that requires unsafe annotations.

Re:Rust Priorities after 1.0 by pcwalton on Friday April 17, 2015 @01:51AM (#9392444)
> The reasons are non aliased pointers allow more aggressive optimization

Rust's type system is all about controlling aliasing. But virtually all garbage collected languages, including Go, have much weaker aliasing guarantees than C does. At least C has "restrict".

Granted, if you compile with "-fno-strict-aliasing", a C compiler will have a tougher time of alias analysis, but that isn't strictly C anymore.

In any case, alias analysis here has nothing to do with garbage collection and everything to do with type safety.

> Does rust have a way to avoid bounds checks on arrays? I suppose that requires unsafe annotations.

In most cases using iterators will avoid them.

Re:Rust Priorities after 1.0 by kibwen on Thursday April 16, 2015 @11:36PM (#9392131)
Rust essentially never wastes cycles on bounds checking thanks to the design of its iterators. The Servo team tells me that bounds checking has never shown up in any performance profiles.
Re:Rust Priorities after 1.0 by higherpurpose on Friday April 17, 2015 @03:51AM (#9392773)
I wonder if after Mozilla writes Servo in Rust 1.x and Google sees how fast Servo is, even compared to its own JS engine, it will also consider writing a new JS engine in Rust 2.x (I assume, by then), as I doubt they'd use Go for that. Same for the whole browsers. Due to the safety features of Rust over C++ we might see both Firefox and Chrome be rewritten in Rust over the next 5 years.
Re:Rust Priorities after 1.0 by Ded7xSEoPKYNsDd on Friday April 17, 2015 @05:18AM (#9393106)
Servo isn't a JS engine, it does make use of Firefox' SpiderMonkey, written in C++.
Re:Rust Priorities after 1.0 by captaincrowbar on Friday April 17, 2015 @12:09AM (#9392215)
"Rust essentially never wastes cycles on bounds checking thanks to the design of its iterators."

Can you explain this or point me to the relevant documentation or code please?

Re:Rust Priorities after 1.0 by kibwen on Friday April 17, 2015 @12:29AM (#9392268)
The documentation on iterators describes the advantages of using iteration rather than direct indexing in a loop: http://doc.rust-lang.org/nightly/book/iterators.html

The gist is that an iterator has enough information about the thing that it's iterating over that we, as library authors, can avoid unnecessary bounds checking and just perform unchecked indexing while retaining all the safety. LLVM is also surprisingly good at automatically vectorizing our iterators.

Re:Rust Priorities after 1.0 by captaincrowbar on Friday April 17, 2015 @07:21PM (#9397738)
Thanks!
Re:Rust Priorities after 1.0 by adamnemecek on Thursday April 16, 2015 @11:44PM (#9392150)
you might want to check this out

http://c2.com/cgi/wiki?SufficientlySmartCompiler

Re:Rust Priorities after 1.0 by andrewchambers on Friday April 17, 2015 @12:39AM (#9392297)
Thanks, A good page.