Live data from Hacker News

New Rust hash table leads Benchmarks Game

benchmarksgame.alioth.debian.org

81–90 of 156 posts

Re: New Rust hash table leads Benchmarks Game

#81

Java is showing quite impressive numbers! 50% overhead over native C implementations was often cited as a good guess for the ultimate efficiency of JIT code generation back in the Self Hotspot days. People who were trying to castigate Go early on as having "Java-like speeds" were really just showing their ignorance of the state of the art of JIT compilation for managed languages and the JVM. Such outdated folk knowle…

[deleted]

Re: New Rust hash table leads Benchmarks Game

#82

Is there something fishy going on with the NaiveHashMap here? What's happening? impl Hasher for NaiveHasher { fn finish(&self) -> u64 { self.0 } fn write(&mut self, _: &[u8]) { unimplemented!() } fn write_u64(&mut self, i: u64) { self.0 = i ^ i >> 7; } }

It's the Rust equivalent of the CUSTOM_HASH_FUNCTION macro in the C source. The comment from there might help explain things:

    // Define a custom hash function to use instead of khash's default hash
    // function. This custom hash function uses a simpler bit shift and XOR which
    // results in several percent faster performance compared to when khash's
    // default hash function is used.
    #define CUSTOM_HASH_FUNCTION(key) (khint32_t)((key) ^ (key)>>7)

Re: New Rust hash table leads Benchmarks Game

#83

Java is showing quite impressive numbers! 50% overhead over native C implementations was often cited as a good guess for the ultimate efficiency of JIT code generation back in the Self Hotspot days. People who were trying to castigate Go early on as having "Java-like speeds" were really just showing their ignorance of the state of the art of JIT compilation for managed languages and the JVM. Such outdated folk knowle…

Note that in many of the other benchmarks, the fastest Java program takes 2x to 4x longer than the fastest C program. Still not bad! But knucleotide shows Java in a better light than most:

http://benchmarksgame.alioth.debian.org/u64q/java.html

(And as always, it's possible that someone can write a much faster Java program than the ones submitted so far.)

Re: New Rust hash table leads Benchmarks Game

#84

Java is showing quite impressive numbers! 50% overhead over native C implementations was often cited as a good guess for the ultimate efficiency of JIT code generation back in the Self Hotspot days. People who were trying to castigate Go early on as having "Java-like speeds" were really just showing their ignorance of the state of the art of JIT compilation for managed languages and the JVM. Such outdated folk knowle…

Probably because people are intelligent enough not to compare speeds inside of a vacuum. When someone denigrates a language as "java-like" they're really just comparing it anecdotally to the sum of all Java projects they've worked with. Rarely is the project a single-purpose, optimized pet-project.

Smalltalk was long castigated for being a "slow, poky interpreted language" long, long after it stopped being that in fact. In all of my time as a consultant for the language vendor, never did I ever come across the VM actually being too slow. In something like 90% of the cases, it was due to IO.

Before I left the Smalltalk part of my career behind, someone had the occasion to compare the parser-compiler of one Smalltalk which was implemented in C with Yacc/Lex with one implemented in pure Smalltalk with a JIT VM. IT turns out, once the console logging was disabled, the JIT VM's parser was just as fast as the one in C.

In my experience of almost 2 decades, it has been a constant that uninformed programmers are especially uninformed about the relative performance of managed languages.

Re: New Rust hash table leads Benchmarks Game

#85
post #77
post #51

Earlier quoted context omitted.

I am asking this genuinely, I always thought and heard LLVM optimizer is inferior to GCC's. Am I wrong ? is there any scientific benchmark for this ?

My understanding was that GCC was better in more scenarios most of the time, but now it seems like Clang has caught up. and Maybe Clang 4.0 is even faster in more. Here are some recent benchmarks from phoronix: http://www.phoronix.com/scan.php?page=article&item=gcc7-clan...

Yeah. But in this kind of tuned benchmark, I doubt clang will do any better across the board - especially not considering the fact that the current programs are likely to be at least somewhat tuned specifically for gcc.

Re: New Rust hash table leads Benchmarks Game

#86

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.

I suspect all languages without exception use some standard library functionality in at least a few of those sample programs, and most "standard" libraries aren't constrained to be self-hosting - so all of em use some native code, probably written in C or C++. I suspect that's true of rust too.

FFI is a fact of life. I can imagine it would be perverting the intent of the game if you explicitly used FFI to delegate the actual core of the benchmark program to C as opposed to using "standard" building blocks, but the distinciton is necessarily vague.

Re: New Rust hash table leads Benchmarks Game

#87
post #86

Earlier quoted context omitted.

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.

I suspect all languages without exception use some standard library functionality in at least a few of those sample programs, and most "standard" libraries aren't constrained to be self-hosting - so all of em use some native code, probably written in C or C++. I suspect that's true of rust too. FFI is a fact of life. I can imagine it would be perverting the intent of the game if you explicitly used FFI to delegate th…

> I suspect that's true of rust too.

rustc uses LLVM and jemalloc (by default). Other than that, it is all Rust.

Re: New Rust hash table leads Benchmarks Game

#90

Java is showing quite impressive numbers! 50% overhead over native C implementations was often cited as a good guess for the ultimate efficiency of JIT code generation back in the Self Hotspot days. People who were trying to castigate Go early on as having "Java-like speeds" were really just showing their ignorance of the state of the art of JIT compilation for managed languages and the JVM. Such outdated folk knowle…

Note that in many of the other benchmarks, the fastest Java program takes 2x to 4x longer than the fastest C program. Still not bad! But knucleotide shows Java in a better light than most: http://benchmarksgame.alioth.debian.org/u64q/java.html (And as always, it's possible that someone can write a much faster Java program than the ones submitted so far.)

And in many cases it doesn't matter, those 2x, 4x longer are still in the accepted expectation time frame.
Post reply on HN