An open API service indexing awesome lists of open source software.

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{}

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.