https://github.com/jeromewu/go-set-benchmark
Benchmark perofmrance of map[]bool and map[]struct{}
https://github.com/jeromewu/go-set-benchmark
Last synced: about 1 year ago
JSON representation
Benchmark perofmrance of map[]bool and map[]struct{}
- Host: GitHub
- URL: https://github.com/jeromewu/go-set-benchmark
- Owner: jeromewu
- Created: 2021-06-11T05:23:11.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2021-06-11T05:53:40.000Z (about 5 years ago)
- Last Synced: 2025-02-05T06:43:40.553Z (over 1 year ago)
- Language: Go
- Size: 2.93 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Set benchmark in Golang
=======================
## Execution
```
$ go get -u golang.org/x/perf/cmd/benchstat
$ make
```
## Result
| | map[]bool | map[]struct{}{} | map[]interface{} |
| -------- | ------------- | ------------------- | -------------------- |
| time/op (execution time) | 3.27s | 3.12s | 5.96s |
| alloc/op (memory consumption) | 884 MB | 802 MB | 1.98 GB |
Using `map[]struct{}` is around 5% faster in time and 10% less memory consumption.