Skip to content
forked from cockroachdb/swiss

Go port of Google's Swiss Table hash table

License

Notifications You must be signed in to change notification settings

go-baselib/swiss

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Swiss Map [WORK IN PROGRESS; DO NOT USE]

swiss.Map is a Go implementation of Google's Swiss Tables hash table design. The Rust version of Swiss Tables is now the HashMap implementation in the Rust standard library.

A swiss.Map[K,V] maps keys of type K to values of type V, similar to Go's builtin map[K]V type. The primary advantage of swiss.Map over Go's builtin map is performance. swiss.Map has similar or slightly better performance Go's builtin map for small map sizes, and significantly better performance at large map sizes.

name                        old time/op  new time/op  delta
StringMaps/n=16/map-10      7.19ns ± 3%  7.28ns ± 0%     ~     (p=0.154 n=9+9)
StringMaps/n=128/map-10     7.66ns ± 5%  7.37ns ± 3%   -3.74%  (p=0.008 n=10+9)
StringMaps/n=1024/map-10    10.8ns ± 3%   7.6ns ± 3%  -29.76%  (p=0.000 n=10+10)
StringMaps/n=8192/map-10    20.3ns ± 2%   7.9ns ± 1%  -61.16%  (p=0.000 n=10+10)
StringMaps/n=131072/map-10  26.1ns ± 0%  14.0ns ± 1%  -46.56%  (p=0.000 n=10+10)
Int64Maps/n=16/map-10       4.96ns ± 1%  4.83ns ± 0%   -2.73%  (p=0.000 n=9+9)
Int64Maps/n=128/map-10      5.19ns ± 3%  4.89ns ± 5%   -5.80%  (p=0.000 n=10+10)
Int64Maps/n=1024/map-10     6.80ns ± 5%  5.01ns ± 2%  -26.32%  (p=0.000 n=10+10)
Int64Maps/n=8192/map-10     17.4ns ± 1%   5.3ns ± 0%  -69.59%  (p=0.000 n=10+7)
Int64Maps/n=131072/map-10   20.6ns ± 0%   6.7ns ± 0%  -67.67%  (p=0.000 n=10+9)

Caveats

  • Resizing a swiss.Map is done for the whole table rather than the incremental resizing performed by Go's builtin map.

TODO

About

Go port of Google's Swiss Table hash table

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 99.7%
  • Shell 0.3%