murmur3

package
v0.0.0-...-2fed64a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 25, 2021 License: GPL-3.0, GPL-3.0, BSD-3-Clause Imports: 2 Imported by: 0

README

murmur3

Native Go implementation of Austin Appleby's third MurmurHash revision (aka MurmurHash3).

Reference algorithm has been slightly hacked as to support the streaming mode required by Go's standard Hash interface.

Benchmarks

Go tip as of 2013-03-11 (i.e almost go1.1), core i7 @ 3.4 Ghz. All runs include hasher instanciation and sequence finalization.


Benchmark32_1       200000000         8.4 ns/op       119.39 MB/s
Benchmark32_2       200000000         9.5 ns/op       211.69 MB/s
Benchmark32_4       500000000         7.9 ns/op       506.24 MB/s
Benchmark32_8       200000000         9.4 ns/op       853.40 MB/s
Benchmark32_16      100000000        12.1 ns/op      1324.19 MB/s
Benchmark32_32      100000000        18.2 ns/op      1760.81 MB/s
Benchmark32_64       50000000        31.2 ns/op      2051.59 MB/s
Benchmark32_128      50000000        58.7 ns/op      2180.34 MB/s
Benchmark32_256      20000000       116.0 ns/op      2194.85 MB/s
Benchmark32_512      10000000       227.0 ns/op      2247.43 MB/s
Benchmark32_1024      5000000       449.0 ns/op      2276.88 MB/s
Benchmark32_2048      2000000       894.0 ns/op      2289.87 MB/s
Benchmark32_4096      1000000      1792.0 ns/op      2284.64 MB/s
Benchmark32_8192       500000      3559.0 ns/op      2301.33 MB/s

Benchmark128_1       50000000        33.2 ns/op        30.15 MB/s
Benchmark128_2       50000000        33.3 ns/op        59.99 MB/s
Benchmark128_4       50000000        35.4 ns/op       112.88 MB/s
Benchmark128_8       50000000        36.6 ns/op       218.30 MB/s
Benchmark128_16      50000000        35.5 ns/op       450.86 MB/s
Benchmark128_32      50000000        35.3 ns/op       905.84 MB/s
Benchmark128_64      50000000        44.3 ns/op      1443.76 MB/s
Benchmark128_128     50000000        58.2 ns/op      2201.02 MB/s
Benchmark128_256     20000000        85.3 ns/op      2999.88 MB/s
Benchmark128_512     10000000       142.0 ns/op      3592.97 MB/s
Benchmark128_1024    10000000       258.0 ns/op      3963.74 MB/s
Benchmark128_2048     5000000       494.0 ns/op      4144.65 MB/s
Benchmark128_4096     2000000       955.0 ns/op      4285.80 MB/s
Benchmark128_8192     1000000      1884.0 ns/op      4347.12 MB/s

Documentation

Overview

Native (and fast) implementation of Austin Appleby's MurmurHash3.

Package murmur3 implements Austin Appleby's non-cryptographic MurmurHash3.

Reference implementation:
   http://code.google.com/p/smhasher/wiki/MurmurHash3

History, characteristics and (legacy) perfs:
   https://sites.google.com/site/murmurhash/
   https://sites.google.com/site/murmurhash/statistics

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New32

func New32() hash.Hash32

func New64

func New64() hash.Hash64

func Sum128

func Sum128(data []byte) (h1 uint64, h2 uint64)

Sum128 returns the MurmurHash3 sum of data. It is equivalent to the following sequence (without the extra burden and the extra allocation):

hasher := New128()
hasher.Write(data)
return hasher.Sum128()

func Sum32

func Sum32(data []byte) uint32

Sum32 returns the MurmurHash3 sum of data. It is equivalent to the following sequence (without the extra burden and the extra allocation):

hasher := New32()
hasher.Write(data)
return hasher.Sum32()

func Sum64

func Sum64(data []byte) uint64

Sum64 returns the MurmurHash3 sum of data. It is equivalent to the following sequence (without the extra burden and the extra allocation):

hasher := New64()
hasher.Write(data)
return hasher.Sum64()

Types

type Hash128

type Hash128 interface {
	hash.Hash
	Sum128() (uint64, uint64)
}

Hack: the standard api doesn't define any Hash128 interface.

func New128

func New128() Hash128

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL