News for hackers. Stuff that matters.
Re:Computer Language Benchmarks Game – Rust vs. Go by biggest_lou on Tuesday December 23, 2014 @06:59PM (#8790888)
The Rust benchmarks will become a lot more interesting (and realistic) when they don't rely so heavily on unsafe calls to C code.
Re:Computer Language Benchmarks Game – Rust vs. Go by smosher_ on Tuesday December 23, 2014 @07:34PM (#8790981)
The unsafe calls to C all seem to be in the gmp^H^H^Hpidigits benchmark. It's unrealistic to avoid gmp in this scenario.
Re:Computer Language Benchmarks Game – Rust vs. Go by dbaupp on Tuesday December 23, 2014 @08:16PM (#8791096)
One can definitely make a case for pidigits mainly being an FFI benchmark.
Re:Computer Language Benchmarks Game – Rust vs. Go by dfkf on Tuesday December 23, 2014 @07:28PM (#8790964)
Only three rust benchmarks use unsafe code, in one of them it's virtually mandatory, and in another it's just one line. On a side note, rust compiler enforces naming conventions, which is kind of cute.
Re:Computer Language Benchmarks Game – Rust vs. Go by tuxychandru on Wednesday December 24, 2014 @01:29AM (#8791835)
The reverse complement program certainly doesn't need unsafe code, but the safe rust version[1] takes 3x the execution time of the unsafe rust version[2]. By comparison the fastest Go version[3] is fairly idiomatic Go without unsafe memory management and takes just 2x the time of the unsafe rust version.

Also, which benchmark did you have in mind when you said unsafe code is mandatory?

[1] http://benchmarksgame.alioth.debian.org/u64q/program.php?tes...

[2] http://benchmarksgame.alioth.debian.org/u64q/program.php?tes...

[3] http://benchmarksgame.alioth.debian.org/u64q/program.php?tes...

Re:Computer Language Benchmarks Game – Rust vs. Go by arthursilva on Wednesday December 24, 2014 @11:22AM (#8793341)
These are REALLY BAD examples, the safe rust version isn't parallelized but the two others are. The unsafe version is just translated C as people already stated. A safe version these days (heading towards 1.0) shouldn't be far of the unsafe versions.
Re:Computer Language Benchmarks Game – Rust vs. Go by igouy on Monday December 29, 2014 @10:58AM (#8810253)
So contribute what you consider to be safe Rust programs.
Re:Computer Language Benchmarks Game – Rust vs. Go by dbaupp on Wednesday December 24, 2014 @02:14AM (#8791931)
That specific safe version, which, IIRC, was a basic translation of the fastest C version. I'd guess that there's other safe variations that are more idiomatic and much faster.
Re:Computer Language Benchmarks Game – Rust vs. Go by tuxychandru on Wednesday December 24, 2014 @02:51AM (#8792016)
May be a faster safe version should be contributed. The current state is that unsafe rust takes half as much time as a safe go program in this benchmark. That is not very interesting because the benefits offered by rust are being given up to perform better, for a problem that doesn't really need unsafe memory access.

Same is the case with spectral norm. It is unsafe rust beating safe go there too.

Re:Computer Language Benchmarks Game – Rust vs. Go by kxo on Tuesday December 23, 2014 @10:26PM (#8791411)
Unsafe is not something that needs to be avoided.

Small, widely-verified blocks of unsafe code should be the norm if unsafe code is necessary. This does not mean "if you're using unsafe you've failed!"