Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Rust is now faster than C

Name: Anonymous 2017-02-21 18:14

http://benchmarksgame.alioth.debian.org/u64q/performance.php?test=knucleotide

How can this be? Since C is as fast as assembly, does this mean Rust does some microcode optimilzation under the hood?

Name: Anonymous 2017-02-22 10:37

>>1
C version uses Khash http://attractivechaos.github.io/klib/#Khash%3A%20generic%20hash%20table:%5B%5BKhash%3A%20generic%20hash%20table%5D%5D

Rust uses a 2-op "xorshift hash"
struct NaiveHasher(u64);
impl Default for NaiveHasher {
fn default() -> Self {
NaiveHasher(0)
}
}
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;
}
}
type NaiveBuildHasher = BuildHasherDefault<NaiveHasher>;
type NaiveHashMap<K, V> = OrderMap<K, V, NaiveBuildHasher>;
type Map = NaiveHashMap<Code, u32>;

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List