Hello Vova,
I must be bad at `reply all', so here's a second attempt at forming a second fragmented response.
All those numbers obviously depend on which implementation and which test cases are selectively chosen for the benchmarks... By using another murmurhash3 implementation [1] (and the small here-below patch [2]), here are the numbers I now get on my workstation (tip, core i7 @ 3.4 Ghz, linux/amd64):
Benchmark_xxhash32 50000000 60.4 ns/op
Benchmark_CRC32IEEE 10000000 168.0 ns/op
Benchmark_Adler32 50000000 52.2 ns/op
Benchmark_Fnv32 10000000 144.0 ns/op
Benchmark_Murmur3Hash32 50000000 53.0 ns/op `Fnv' clearly suffers from having on such small sequences from requiring a plain hasher, `crc' could really benefit from switching to the Castagnoli sequence that (most of time) has a hardware implementation (
http://golang.org/src/pkg/hash/crc32/crc32_amd64.s), and `murmurhash3' could also be made faster by duplicating some part of the code (originally made for larger and segmented writes).
All of those reported benchmarks being based on pure Go implementations (and on the stock gc compiler), I indeed wonder how often does the burden of writing/maintaining wrappers really paybacks in real life situations ;)?..
Cheers,
Sebastien
[2]
--- xxhash_test.go.1 2013-03-11 09:15:48.890205106 +0100
+++ xxhash_test.go 2013-03-11 15:26:58.180768743 +0100
@@ -7,6 +7,7 @@
"hash/adler32"
"hash/crc32"
"hash/fnv"
+ "murmur3"
"testing"
)
@@ -143,13 +144,15 @@
func Benchmark_Fnv32(b *testing.B) {
h := fnv.New32()
for i := 0; i < b.N; i++ {
- h.Sum(blob1)
+ h.Write(blob1)
+ h.Sum(nil)
+ h.Reset()
}
}
-func Benchmark_MurmurHash3Hash32(b *testing.B) {
+func Benchmark_Murmur3Hash32(b *testing.B) {
for i := 0; i < b.N; i++ {
- mmh3Hash32(blob1)
+ murmur3.Sum32(blob1)
}
}
On Sun, Mar 10, 2013 at 9:09 AM, Vova Niki <
vov...@gmail.com> wrote:
> Heres a pure go implementation I wrote just now, and it passes
> StephaneBunel/xxhash-go tests
>
https://github.com/vova616/xxhash>
> Bench results (go tip version devel +db1736b03009):
> vova616/xxhash:
> Benchmark_xxhash32 50000000 57.6 ns/op
> Benchmark_CRC32IEEE 20000000 136 ns/op
> Benchmark_Adler32 10000000 171 ns/op
> Benchmark_Fnv32 10000000 157 ns/op
> Benchmark_MurmurHash3Hash32 1000000 1857 ns/op
>
> StephaneBunel/xxhash-go:
> Benchmark_xxhash32 10000000 138 ns/op
> Benchmark_CRC32IEEE 10000000 142 ns/op
> Benchmark_Adler32 10000000 166 ns/op
> Benchmark_Fnv32 10000000 279 ns/op
> Benchmark_MurmurHash3Hash32 500000 4436 ns/op
>
> go 1.0.3
> vova616/xxhash:
> Benchmark_xxhash32 5000000 349 ns/op
> Benchmark_CRC32IEEE 10000000 149 ns/op
> Benchmark_Adler32 10000000 166 ns/op
> Benchmark_Fnv32 10000000 280 ns/op
> Benchmark_MurmurHash3Hash32 500000 4324 ns/op
>
> StephaneBunel/xxhash-go:
> Benchmark_xxhash32 10000000 150 ns/op
> Benchmark_CRC32IEEE 10000000 136 ns/op
> Benchmark_Adler32 10000000 171 ns/op
> Benchmark_Fnv32 10000000 155 ns/op
> Benchmark_MurmurHash3Hash32 1000000 1887 ns/op
>
> On Saturday, March 9, 2013 12:00:58 PM UTC+2,
st.k...@gmail.com wrote:
>>
>> Hi,