News for hackers. Stuff that matters.
Re:Rust Priorities after 1.0 by seanmcdirmid on Thursday April 16, 2015 @11:06PM (#9392056)
As an upper performance bound for a GC language, I don't think Go will be able to surpass C# (which has stack allocation in the form of structs, ahead of time compilation, and many other goodies). Rust, on the other hand, has more potential as a non GC language, though at the end of the day it might be hard to tell given equivalent applications.
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.
Re:Rust Priorities after 1.0 by gillianseed on Thursday April 16, 2015 @11:44PM (#9392151)
>As an upper performance bound for a GC language, I don't think Go will be able to surpass C#

I don't know how well Mono C# compares to Microsoft's version, but looking at:

http://benchmarksgame.alioth.debian.org/u64q/benchmark.php?t...

Shows that Go certainly beats Mono #C in these benchmarks (often by a very wide margin).

From a technical standpoint I don't see any reason why Go would not be faster than C#, how would 'ahead of time compilation' bring C# a performance benefit over Go ?

Re:Rust Priorities after 1.0 by seanmcdirmid on Friday April 17, 2015 @12:47AM (#9392309)
Mono is considered slow in the .net world. Lets hope the new stance on open source makes things better.

Go and C# are dealing with similar constraints, there is no language design advantage in go with respect to performance, and the resources applied to implementation are similar.