https://github.com/einfachandy/bench-hashmaps
benchmark for golang hash maps
https://github.com/einfachandy/bench-hashmaps
bench benchmark benchmarking data-structures generic go golang hash-map hash-maps hash-table hash-tables hashmap hashtable performance-analysis performance-testing swisstable
Last synced: 2 months ago
JSON representation
benchmark for golang hash maps
- Host: GitHub
- URL: https://github.com/einfachandy/bench-hashmaps
- Owner: EinfachAndy
- License: mit
- Created: 2023-06-04T13:38:26.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-07-04T16:56:10.000Z (over 2 years ago)
- Last Synced: 2024-01-29T18:15:08.756Z (about 2 years ago)
- Topics: bench, benchmark, benchmarking, data-structures, generic, go, golang, hash-map, hash-maps, hash-table, hash-tables, hashmap, hashtable, performance-analysis, performance-testing, swisstable
- Language: HTML
- Homepage:
- Size: 602 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Golang Hash Map Benchmark
[](https://github.com/EinfachAndy/bench-hashmaps/blob/main/LICENSE)
# How to run:
```bash
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
```bash
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`.
```bash
make charts
firefox results/IntelRCoreTMi7-10610UCPU180GHz_2023-06-11_00-36-01.out.html
```
## Results
* [Intel Core i7-10610U](https://einfachandy.github.io/bench-hashmaps/results/IntelRCoreTMi7-10610UCPU180GHz_2023-07-01_12-04-35.out.html "Plot")
* [Intel Core i7-7700](https://einfachandy.github.io/bench-hashmaps/results/IntelRCoreTMi7-7700CPU360GHz_2023-07-01_15-43-00.out.html "Plot")
# 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](https://tessil.github.io/2016/08/29/benchmark-hopscotch-map.html).