Live data from Hacker News

New Rust hash table leads Benchmarks Game

benchmarksgame.alioth.debian.org

31–40 of 156 posts

Re: New Rust hash table leads Benchmarks Game

#34

Earlier quoted context omitted.

Is there any reason why we can't have a "C clang"? Or has just nobody bothered yet?

Circa 2011 the maintainer of the benchmark game decided to mostly only allow one implementation of each language[0] following pypy developers trying to get program alternatives which weren't pypy-pessimal. [0] some languages get a bye for some reason e.g. MRI and JRuby, but no pypy, and which implementation is blessed is also arbitrary e.g. javascript is v8 but lua is lua.

2011 didn't have as widespread Clang/LLVM usage. Now that it is so ubiquitous, probably a good time to revisit for C...

C needs to defend its reputation now!

Re: New Rust hash table leads Benchmarks Game

#35
post #10

It is new Rust hash table from external crate.

The default hash table has better security against malicious input by using a slower hashing algorithm. Its the right default, but if you really want performance and to compete with C/C++, you have to use an algorithm that makes different tradeoffs, or you would be comparing apples to oranges.

> or you would be comparing apples to oranges

Do the other programs use that same hash table algorithm?

http://www.sebastiansylvan.com/post/robin-hood-hashing-shoul...

Re: New Rust hash table leads Benchmarks Game

#36

It seems to me that there are a lot of apples-to-oranges comparisons here? Some implementations are using the language's standard library hashtable implementation while others are using 3rd party version (with different algorithms and data structures across all of them), some are using multiple threads while others are single threaded etc. As a result, I wouldn't read too much into the rankings you see here.

And some languages are allowed to use FFI to make their impl faster. There's some rule about this that I don't understand, but oh well. It's all for fun, not serious. But come on, now Rust can legitimately be called "faster than C" ;) At least until the Clang C version is added... or maybe it will still be faster.

>And some languages are allowed to use FFI to make their impl faster. There's some rule about this that I don't understand, but oh well. It's all for fun, not serious.

Actually it's pretty easy: if you can write a faster version in any language, given whatever is there in the language, even if it's c implemented standard library stuff, do it.

The implementations are not meant to be final -- people can contribute faster ones.

Re: New Rust hash table leads Benchmarks Game

#37
post #10

It is new Rust hash table from external crate.

The default hash table has better security against malicious input by using a slower hashing algorithm. Its the right default, but if you really want performance and to compete with C/C++, you have to use an algorithm that makes different tradeoffs, or you would be comparing apples to oranges.

> The default hash table has better security against malicious input by using a slower hashing algorithm.

I think an adaptive hash that switches from fast to secure when collisions are detected would make a better default choice (at the cost of some implementation complexity).

Or possibly even an implementation with log(n) worst case complexity.

Re: New Rust hash table leads Benchmarks Game

#39

The rust version is using multiple cpus using a pool concept (which looks a lot like the multiprocessing module from python so kudos there). But the C version is single threaded from what I can tell. So rust is safe but threaded to be faster than single threaded C which isn't that much slower. Hmm...

That's not true. If you look at the comparisons, the cpu time taken by C is actually more than rust, and the cpu load looks about even. Note the C version uses: #pragma omp parallel sections

>.. and the cpu load looks about even.

318% is 20% bigger then 265%.

Post reply on HN