Skip to content

kelindar/hashbench

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Experiment: Benchmarks of Hash Functions in Go

This repository contains a small experiment of mine, trying out different hash functions and comparing their performance against each other on different data sizes. Note that this is not the only reason to choose one hash function over another, as there's the collisions and randomness that need to be taken into consideration.

  32-bit |                 crc |   10 B |          12.83 ns/op |   779.17 MB/s
  32-bit |                 crc |   25 B |          10.19 ns/op |  2453.83 MB/s
  32-bit |                 crc |  100 B |          18.63 ns/op |  5367.22 MB/s
  32-bit |                 crc | 4.0 kB |          154.1 ns/op | 25958.51 MB/s
  32-bit |                 crc |  10 MB |         426226 ns/op | 23461.71 MB/s
  32-bit |                 crc |  50 MB |        2914291 ns/op | 17156.83 MB/s
  32-bit | dgryski/go-marvin32 |   10 B |          5.609 ns/op |  1782.88 MB/s
  32-bit | dgryski/go-marvin32 |   25 B |          9.233 ns/op |  2707.80 MB/s
  32-bit | dgryski/go-marvin32 |  100 B |          30.32 ns/op |  3298.01 MB/s
  32-bit | dgryski/go-marvin32 | 4.0 kB |           1175 ns/op |  3404.50 MB/s
  32-bit | dgryski/go-marvin32 |  10 MB |        3064783 ns/op |  3262.87 MB/s
  32-bit | dgryski/go-marvin32 |  50 MB |       14907355 ns/op |  3354.05 MB/s
  32-bit |    mtchavez/jenkins |   10 B |          10.17 ns/op |   982.84 MB/s
  32-bit |    mtchavez/jenkins |   25 B |          24.16 ns/op |  1034.88 MB/s
  32-bit |    mtchavez/jenkins |  100 B |          105.3 ns/op |   949.68 MB/s
  32-bit |    mtchavez/jenkins | 4.0 kB |           4207 ns/op |   950.85 MB/s
  32-bit |    mtchavez/jenkins |  10 MB |       10359668 ns/op |   965.28 MB/s
  32-bit |    mtchavez/jenkins |  50 MB |       52553105 ns/op |   951.42 MB/s
  32-bit |        twmb/murmur3 |   10 B |          6.270 ns/op |  1863.99 MB/s
  32-bit |        twmb/murmur3 |   25 B |          10.21 ns/op |  2449.72 MB/s
  32-bit |        twmb/murmur3 |  100 B |          28.19 ns/op |  3546.98 MB/s
  32-bit |        twmb/murmur3 | 4.0 kB |           1025 ns/op |  3902.01 MB/s
  32-bit |        twmb/murmur3 |  10 MB |        2538669 ns/op |  3939.07 MB/s
  32-bit |        twmb/murmur3 |  50 MB |       13490702 ns/op |  3706.26 MB/s
  32-bit |     dgryski/go-farm |   10 B |          5.742 ns/op |  1741.60 MB/s
  32-bit |     dgryski/go-farm |   25 B |          10.67 ns/op |  2342.39 MB/s
  32-bit |     dgryski/go-farm |  100 B |          19.04 ns/op |  5252.27 MB/s
  32-bit |     dgryski/go-farm | 4.0 kB |          553.6 ns/op |  7225.77 MB/s
  32-bit |     dgryski/go-farm |  10 MB |        1392766 ns/op |  7179.96 MB/s
  32-bit |     dgryski/go-farm |  50 MB |        7077163 ns/op |  7064.98 MB/s
  64-bit |                 crc |   10 B |          13.99 ns/op |   714.70 MB/s
  64-bit |                 crc |   25 B |          33.96 ns/op |   736.07 MB/s
  64-bit |                 crc |  100 B |          45.68 ns/op |  2189.19 MB/s
  64-bit |                 crc | 4.0 kB |           1615 ns/op |  2476.38 MB/s
  64-bit |                 crc |  10 MB |        4009579 ns/op |  2494.03 MB/s
  64-bit |                 crc |  50 MB |       20659251 ns/op |  2420.22 MB/s
  64-bit |                fnv1 |   10 B |          9.975 ns/op |  1002.48 MB/s
  64-bit |                fnv1 |   25 B |          17.09 ns/op |  1462.96 MB/s
  64-bit |                fnv1 |  100 B |          77.95 ns/op |  1282.87 MB/s
  64-bit |                fnv1 | 4.0 kB |           3394 ns/op |  1178.56 MB/s
  64-bit |                fnv1 |  10 MB |        8393202 ns/op |  1191.44 MB/s
  64-bit |                fnv1 |  50 MB |       41951907 ns/op |  1191.84 MB/s
  64-bit |               fnv1a |   10 B |          9.511 ns/op |  1051.44 MB/s
  64-bit |               fnv1a |   25 B |          17.05 ns/op |  1466.07 MB/s
  64-bit |               fnv1a |  100 B |          76.90 ns/op |  1300.40 MB/s
  64-bit |               fnv1a | 4.0 kB |           3325 ns/op |  1202.86 MB/s
  64-bit |               fnv1a |  10 MB |        8483582 ns/op |  1178.75 MB/s
  64-bit |               fnv1a |  50 MB |       42048304 ns/op |  1189.11 MB/s
  64-bit |             maphash |   10 B |          12.09 ns/op |   826.79 MB/s
  64-bit |             maphash |   25 B |          12.32 ns/op |  2029.96 MB/s
  64-bit |             maphash |  100 B |          14.23 ns/op |  7026.76 MB/s
  64-bit |             maphash | 4.0 kB |          329.4 ns/op | 12144.03 MB/s
  64-bit |             maphash |  10 MB |         831943 ns/op | 12020.05 MB/s
  64-bit |             maphash |  50 MB |        4373466 ns/op | 11432.58 MB/s
  64-bit |      cespare/xxhash |   10 B |          5.576 ns/op |  1793.46 MB/s
  64-bit |      cespare/xxhash |   25 B |          6.476 ns/op |  3860.54 MB/s
  64-bit |      cespare/xxhash |  100 B |          12.59 ns/op |  7945.68 MB/s
  64-bit |      cespare/xxhash | 4.0 kB |          217.2 ns/op | 18413.62 MB/s
  64-bit |      cespare/xxhash |  10 MB |         562809 ns/op | 17768.03 MB/s
  64-bit |      cespare/xxhash |  50 MB |        3312274 ns/op | 15095.37 MB/s
  64-bit |    dgryski/go-metro |   10 B |          4.476 ns/op |  2234.24 MB/s
  64-bit |    dgryski/go-metro |   25 B |          6.343 ns/op |  3941.17 MB/s
  64-bit |    dgryski/go-metro |  100 B |          12.69 ns/op |  7878.21 MB/s
  64-bit |    dgryski/go-metro | 4.0 kB |          200.1 ns/op | 19985.52 MB/s
  64-bit |    dgryski/go-metro |  10 MB |         542055 ns/op | 18448.32 MB/s
  64-bit |    dgryski/go-metro |  50 MB |        3179164 ns/op | 15727.40 MB/s
  64-bit |        twmb/murmur3 |   10 B |          5.651 ns/op |  1769.70 MB/s
  64-bit |        twmb/murmur3 |   25 B |          6.825 ns/op |  3663.26 MB/s
  64-bit |        twmb/murmur3 |  100 B |          14.35 ns/op |  6968.19 MB/s
  64-bit |        twmb/murmur3 | 4.0 kB |          438.1 ns/op |  9129.73 MB/s
  64-bit |        twmb/murmur3 |  10 MB |        1058814 ns/op |  9444.53 MB/s
  64-bit |        twmb/murmur3 |  50 MB |        5443040 ns/op |  9186.04 MB/s
  64-bit |   minio/highwayhash |   10 B |          39.66 ns/op |   252.17 MB/s
  64-bit |   minio/highwayhash |   25 B |          41.23 ns/op |   606.34 MB/s
  64-bit |   minio/highwayhash |  100 B |          46.47 ns/op |  2151.84 MB/s
  64-bit |   minio/highwayhash | 4.0 kB |          235.0 ns/op | 17023.84 MB/s
  64-bit |   minio/highwayhash |  10 MB |         590986 ns/op | 16920.87 MB/s
  64-bit |   minio/highwayhash |  50 MB |        3308729 ns/op | 15111.54 MB/s
  64-bit |    dgryski/go-sip13 |   10 B |          9.321 ns/op |  1072.82 MB/s
  64-bit |    dgryski/go-sip13 |   25 B |          12.09 ns/op |  2067.72 MB/s
  64-bit |    dgryski/go-sip13 |  100 B |          24.98 ns/op |  4002.88 MB/s
  64-bit |    dgryski/go-sip13 | 4.0 kB |          660.0 ns/op |  6060.46 MB/s
  64-bit |    dgryski/go-sip13 |  10 MB |        1650419 ns/op |  6059.07 MB/s
  64-bit |    dgryski/go-sip13 |  50 MB |        8451694 ns/op |  5915.97 MB/s
  64-bit |        dgryski/tsip |   10 B |          5.839 ns/op |  1712.62 MB/s
  64-bit |        dgryski/tsip |   25 B |          7.937 ns/op |  3149.78 MB/s
  64-bit |        dgryski/tsip |  100 B |          18.44 ns/op |  5422.99 MB/s
  64-bit |        dgryski/tsip | 4.0 kB |          627.6 ns/op |  6373.59 MB/s
  64-bit |        dgryski/tsip |  10 MB |        1514385 ns/op |  6603.34 MB/s
  64-bit |        dgryski/tsip |  50 MB |        7735131 ns/op |  6464.02 MB/s
  64-bit |     dgryski/go-farm |   10 B |          3.815 ns/op |  2621.07 MB/s
  64-bit |     dgryski/go-farm |   25 B |          4.483 ns/op |  5576.64 MB/s
  64-bit |     dgryski/go-farm |  100 B |          22.00 ns/op |  4546.44 MB/s
  64-bit |     dgryski/go-farm | 4.0 kB |          298.3 ns/op | 13407.64 MB/s
  64-bit |     dgryski/go-farm |  10 MB |         768168 ns/op | 13017.98 MB/s
  64-bit |     dgryski/go-farm |  50 MB |        4360451 ns/op | 11466.70 MB/s
  64-bit |          zeebo/xxh3 |   10 B |          3.388 ns/op |  2951.80 MB/s
  64-bit |          zeebo/xxh3 |   25 B |          4.379 ns/op |  5709.54 MB/s
  64-bit |          zeebo/xxh3 |  100 B |          9.872 ns/op | 10129.57 MB/s
  64-bit |          zeebo/xxh3 | 4.0 kB |          79.60 ns/op | 50253.12 MB/s
  64-bit |          zeebo/xxh3 |  10 MB |         303680 ns/op | 32929.35 MB/s
  64-bit |          zeebo/xxh3 |  50 MB |        2939704 ns/op | 17008.51 MB/s 

About

Benchmarking hash functions in Go

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages