Skip to content

EinfachAndy/bench-hashmaps

Repository files navigation

Golang Hash Map Benchmark

MIT License

How to run:

git clone git@github.com:EinfachAndy/bench-hashmaps.git
cd bench-hashmaps
make run-bench
make charts

Run custom benchmark

The Makefile target run-bench executes a new benchmark run and stores the results in results/<>.out. The Default settings can be changed with the following environment variables:

  • RANGES list of integers (n)
  • MAPS list of map names
MAPS="swiss std" RANGES="50000 100000 200000 400000" make run-bench

Supported hash maps

Name Module
std golang map
robin https://pkg.go.dev/github.com/EinfachAndy/hashmaps#RobinHood (lf 0.8)
robinLowLoad https://pkg.go.dev/github.com/EinfachAndy/hashmaps#RobinHood (lf 0.5)
hopscotch https://pkg.go.dev/github.com/EinfachAndy/hashmaps#Hopscotch (lf 0.8)
hopscotchLowLoad https://pkg.go.dev/github.com/EinfachAndy/hashmaps#Hopscotch (lf 0.5)
unordered https://pkg.go.dev/github.com/EinfachAndy/hashmaps#Unordered
flat https://pkg.go.dev/github.com/EinfachAndy/hashmaps#Flat
swiss https://pkg.go.dev/github.com/dolthub/swiss#Map
generic https://pkg.go.dev/github.com/zyedidia/generic/hashmap#Map
cornelk https://pkg.go.dev/github.com/cornelk/hashmap#Map
sync https://pkg.go.dev/sync#Map

Generate charts

The Makefile target charts generate HTML output for all benchmark files in the directory results.

make charts
firefox results/IntelRCoreTMi7-10610UCPU180GHz_2023-06-11_00-36-01.out.html

Results

Contributing

If you would like to add a new benchmark or hash map, feel free to contribute.

Note:

This benchmark is inspired from Benchmark of major hash maps implementations.