├── .gitignore
├── LICENSE
├── Makefile
├── README.md
├── calls
├── README.md
├── asm
│ ├── asm.go
│ └── asm.s
├── call_test.go
└── cgo.go
├── cmd
└── gobench2csv
│ └── main.go
├── glide.lock
├── glide.yaml
├── hashing
├── README.md
└── benchmark_test.go
├── http
├── evio.go
└── parse_test.go
├── json
├── README.md
├── data.go
├── easyjson_test.go
├── example.json
└── standard_test.go
├── queues
├── README.md
└── one_to_one
│ └── queues_test.go
├── reporting
├── README.md
├── gobench_histogram_nsop.r
├── gobench_multi_nsop.r
├── gobench_single_nsop.r
├── hdr_histogram.r
└── setup.r
├── results
├── calls.png
├── hashing-histogram.png
├── hashing-multi.png
├── json-multi.png
├── queues.png
├── queues_p90.png
├── queues_p99.png
├── queues_p999.png
├── queues_p9999.png
├── queues_p99999.png
├── queues_p999999.png
├── samples
│ ├── channel.histogram
│ ├── diode.histogram
│ ├── fastlane.histogram
│ ├── hashing.log
│ ├── hrtime.histogram
│ ├── nanotime.histogram
│ ├── onering.histogram
│ ├── queues.log
│ └── time.log
├── time.png
├── time_p90.png
├── time_p99.png
├── time_p999.png
├── time_p9999.png
├── time_p99999.png
└── time_p999999.png
└── time
├── README.md
├── nanos.s
└── time_test.go
/.gitignore:
--------------------------------------------------------------------------------
1 | # Binaries for programs and plugins
2 | *.exe
3 | *.dll
4 | *.so
5 | *.dylib
6 |
7 | # Test binary, build with `go test -c`
8 | *.test
9 |
10 | # Output of the go coverage tool, specifically when used with LiteIDE
11 | *.out
12 |
13 | # Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736
14 | .glide/
15 |
16 | vendor
17 |
18 | *.results
19 |
20 | glide
21 | easyjson
22 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 Kelly Sommers
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | .PHONY: hashing http queues json time
2 |
3 | r: reporting/setup.r
4 | @Rscript reporting/setup.r
5 |
6 | $(GOPATH)/bin/glide:
7 | @echo "Install Glide..."
8 | @curl https://glide.sh/get | sh
9 |
10 | $(GOPATH)/bin/easyjson:
11 | @echo "Install Easyjson..."
12 | @go get -u github.com/mailru/easyjson/...
13 |
14 | vendor: $(GOPATH)/bin/glide glide.yaml glide.lock
15 | @echo "Install deps..."
16 | @glide install
17 |
18 | generate: $(GOPATH)/bin/easyjson
19 | @echo "Generate go files..."
20 | @go generate ./...
21 |
22 | results:
23 | @echo "Create results folder..."
24 | @mkdir results
25 |
26 | calls: results
27 | @rm -rf ./results/calls.*
28 | @go test ./calls -benchmem -bench=. | tee ./results/calls.log
29 |
30 | calls-report: calls
31 | @Rscript reporting/gobench_single_nsop.r ./results/calls.log ./results/calls.png
32 |
33 | hashing: results
34 | @rm -rf ./results/hashing.*
35 | @go test ./hashing -benchmem -bench=. | tee ./results/hashing.log
36 |
37 | hashing-report: hashing
38 | @Rscript reporting/gobench_multi_nsop.r ./results/hashing.log ./results/hashing-multi.png
39 | @Rscript reporting/gobench_histogram_nsop.r ./results/hashing.log ./results/hashing-histogram.png
40 |
41 | queues: results
42 | @rm -rf ./results/queues.*
43 | @go test ./queues/one_to_one -benchmem -bench=. | tee ./results/queues.log
44 |
45 | queues-report: queues
46 | @Rscript reporting/gobench_single_nsop.r ./results/queues.log ./results/queues.png
47 | @Rscript ./reporting/hdr_histogram.r ./results/channel.histogram ./results/diode.histogram ./results/diode.histogram ./results/onering.histogram 1 results/queues_p90.png
48 | @Rscript ./reporting/hdr_histogram.r ./results/channel.histogram ./results/diode.histogram ./results/diode.histogram ./results/onering.histogram 2 results/queues_p99.png
49 | @Rscript ./reporting/hdr_histogram.r ./results/channel.histogram ./results/diode.histogram ./results/diode.histogram ./results/onering.histogram 3 results/queues_p999.png
50 | @Rscript ./reporting/hdr_histogram.r ./results/channel.histogram ./results/diode.histogram ./results/diode.histogram ./results/onering.histogram 4 results/queues_p9999.png
51 | @Rscript ./reporting/hdr_histogram.r ./results/channel.histogram ./results/diode.histogram ./results/diode.histogram ./results/onering.histogram 5 results/queues_p99999.png
52 | @Rscript ./reporting/hdr_histogram.r ./results/channel.histogram ./results/diode.histogram ./results/diode.histogram ./results/onering.histogram 6 results/queues_p999999.png
53 |
54 | json: vendor generate results
55 | @rm -rf ./results/json.*
56 | @go test ./json -benchmem -bench=. | tee ./results/json.log
57 |
58 | json-report: json
59 | @Rscript reporting/gobench_multi_nsop.r ./results/json.log ./results/json-multi.png
60 |
61 | time: results
62 | @rm -rf ./results/time.*
63 | @go test ./time -benchmem -bench=. | tee ./results/time.log
64 |
65 | time-report: time
66 | @Rscript ./reporting/gobench_single_nsop.r ./results/time.log ./results/time.png
67 | @Rscript ./reporting/hdr_histogram.r ./results/nanotime.histogram ./results/hrtime.histogram 1 results/time_p90.png
68 | @Rscript ./reporting/hdr_histogram.r ./results/nanotime.histogram ./results/hrtime.histogram 2 results/time_p99.png
69 | @Rscript ./reporting/hdr_histogram.r ./results/nanotime.histogram ./results/hrtime.histogram 3 results/time_p999.png
70 | @Rscript ./reporting/hdr_histogram.r ./results/nanotime.histogram ./results/hrtime.histogram 4 results/time_p9999.png
71 | @Rscript ./reporting/hdr_histogram.r ./results/nanotime.histogram ./results/hrtime.histogram 5 results/time_p99999.png
72 | @Rscript ./reporting/hdr_histogram.r ./results/nanotime.histogram ./results/hrtime.histogram 6 results/time_p999999.png
73 |
74 | benchmark: hashing queues json time
75 |
76 | reports: hashing-report queues-report json-report time-report calls-report
77 |
78 | gobench2csv: cmd/gobench2csv/main.go
79 | @go build -o build/gobench2csv cmd/gobench2csv/main.go
80 |
81 | plot: results
82 | @Rscript ./reporting/gobench_multi_nsop.r ./results/hashing.log ./results/hashing-multi.png
83 | @Rscript ./reporting/gobench_histogram_nsop.r ./results/hashing.log ./results/hashing-histogram.png
84 | @Rscript ./reporting/gobench_single_nsop.r ./results/queues.log ./results/queues.png
85 | @Rscript ./reporting/gobench_multi_nsop.r ./results/json.log ./results/json-multi.png
86 |
87 | http: http/evio.go
88 | @go build -o build/http/evio http/evio.go
89 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | This repository includes various Go benchmarks of data structures and services split into sub directories. Please feel free to contribute your own. This repo is meant to be a collection for the community to work on together.
2 |
3 | # Prerequisites
4 | ### macOS
5 | ```
6 | brew install r
7 | ```
8 |
9 | ### Ubuntu
10 | ```
11 | sudo apt install curl libcurl4-openssl-dev libxml2-dev r-base
12 | ```
13 |
14 | ### Dependencies
15 | ```
16 | make deps
17 | ```
18 |
19 | # Benchmarks
20 | [Function call overhead](https://github.com/kellabyte/go-benchmarks/tree/master/calls)
21 | ```
22 | make calls
23 | ```
24 |
25 | [Hashing algorithms](https://github.com/kellabyte/go-benchmarks/tree/master/hashing)
26 | ```
27 | make hashing
28 | ```
29 |
30 | [Json](https://github.com/kellabyte/go-benchmarks/tree/master/json)
31 | ```
32 | make json
33 | ```
34 |
35 | [Queue data structures](https://github.com/kellabyte/go-benchmarks/tree/master/queues)
36 | ```
37 | make queues
38 | ```
39 | # Setup
40 | #### Hardware
41 | ```
42 | [2] Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
43 | [16] 1600 MHz 8GB DDR-3 Single Rank DIMM
44 | [1] Raid Controller
45 | [8] Intel S3520 SSD 240GB
46 | [1] Broadcom 5720 1Gbps Ethernet Adapter
47 | [2] Intel Ethernet Server Adapter X520 10GbE Bonded (20GbE)
48 | ```
49 |
50 | #### Network Performance
51 | ```
52 | Interval Transfer Bandwidth
53 | 0.0-10.0 sec 21.3 GBytes 18.3 Gbits/sec
54 | 0.0-10.0 sec 21.2 GBytes 18.2 Gbits/sec
55 | 0.0-10.0 sec 21.4 GBytes 18.3 Gbits/sec
56 | ```
57 |
58 | #### Disk Performance
59 | ```
60 | sudo hdparm -Tt /dev/sda
61 |
62 | /dev/sda:
63 | Timing cached reads: 21800 MB in 1.99 seconds = 10933.80 MB/sec
64 | Timing buffered disk reads: 2828 MB in 3.00 seconds = 942.53 MB/sec
65 | ```
66 |
67 | #### Operating System
68 | ```
69 | Distributor ID: Ubuntu
70 | Description: Ubuntu 16.04.4 LTS
71 | Release: 16.04
72 | Codename: xenial
73 |
74 | Linux version 4.4.0-121-generic
75 | (buildd@lcy01-amd64-004)
76 | (gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.9) )
77 | #145-Ubuntu SMP Fri Apr 13 13:47:23 UTC 2018
78 | ```
79 |
--------------------------------------------------------------------------------
/calls/README.md:
--------------------------------------------------------------------------------
1 | This directory includes function call overhead benchmarks.
2 |
3 | # Setup
4 | ```
5 | Ubuntu Linux
6 | Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz x 20 Cores (40 Hyperthreaded)
7 | L1 Cache: 320 kB
8 | L2 Cache: 2560 kB
9 | L3 Cache: 25600 kB
10 | Memory: 126 GB
11 | ```
12 |
13 | This benchmark measures the overhead of making a function call to a function written in `ASM`, `CGO` and `Go`.
14 |
15 | # Results
16 | [](https://github.com/kellabyte/go-benchmarks/raw/master/results/calls.png)
17 |
18 | ```
19 | make calls
20 |
21 | goos: linux
22 | goarch: amd64
23 | pkg: github.com/kellabyte/go-benchmarks/calls
24 | BenchmarkCGO-40 20000000 64.6 ns/op 15.47 MB/s 0 B/op 0 allocs/op
25 | BenchmarkGo-40 1000000000 2.23 ns/op 447.64 MB/s 0 B/op 0 allocs/op
26 | BenchmarkAsm-40 500000000 2.70 ns/op 369.69 MB/s 0 B/op 0 allocs/op
27 | PASS
28 | ok github.com/kellabyte/go-benchmarks/calls 5.531s
29 | ```
30 |
31 | # Credit
32 | Special thanks to Egon Elbre for providing benchmarks. Original source was taken from [his repository](https://github.com/egonelbre/exp/tree/master/bench/call).
--------------------------------------------------------------------------------
/calls/asm/asm.go:
--------------------------------------------------------------------------------
1 | package asm
2 |
3 | func Nop()
4 |
--------------------------------------------------------------------------------
/calls/asm/asm.s:
--------------------------------------------------------------------------------
1 | TEXT ·Nop+0(SB),$0-0
2 | RET
3 |
--------------------------------------------------------------------------------
/calls/call_test.go:
--------------------------------------------------------------------------------
1 | package calls
2 |
3 | import (
4 | "testing"
5 |
6 | "github.com/kellabyte/go-benchmarks/calls/asm"
7 | )
8 |
9 | func BenchmarkCGO(b *testing.B) {
10 | for i := 0; i < b.N; i++ {
11 | CNop()
12 | b.SetBytes(1)
13 | }
14 | }
15 |
16 | func BenchmarkGo(b *testing.B) {
17 | for i := 0; i < b.N; i++ {
18 | Nop()
19 | b.SetBytes(1)
20 | }
21 | }
22 |
23 | func BenchmarkAsm(b *testing.B) {
24 | for i := 0; i < b.N; i++ {
25 | asm.Nop()
26 | b.SetBytes(1)
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/calls/cgo.go:
--------------------------------------------------------------------------------
1 | package calls
2 |
3 | //void nop() { }
4 | import "C"
5 |
6 | //go:noinline
7 | func Nop() {}
8 |
9 | func CNop() { C.nop() }
10 |
--------------------------------------------------------------------------------
/cmd/gobench2csv/main.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "encoding/csv"
5 | "fmt"
6 | "log"
7 | "os"
8 | "strconv"
9 | "strings"
10 |
11 | "golang.org/x/tools/benchmark/parse"
12 | )
13 |
14 | func main() {
15 | if len(os.Args) < 3 {
16 | fmt.Println("Please provide an input go bench result file.")
17 | fmt.Println("Example: gobench2csv results.log")
18 | os.Exit(1)
19 | }
20 | // Open go bench file.
21 | inputFile, err := os.Open(os.Args[1])
22 | if err != nil {
23 | log.Fatal(err)
24 | }
25 | defer inputFile.Close()
26 |
27 | // Open output csv file.
28 | outputFile, err := os.Create(os.Args[2])
29 | if err != nil {
30 | log.Fatal("cannot create output csv file", err)
31 | }
32 | defer outputFile.Close()
33 |
34 | writer := csv.NewWriter(outputFile)
35 | defer writer.Flush()
36 |
37 | // Start parsing the go bench input.
38 | set, err := parse.ParseSet(inputFile)
39 | if err != nil {
40 | log.Fatal(err)
41 | }
42 |
43 | // Write the headers line to the csv file.
44 | headers := [5]string{"Name", "ns/op", "throughput", "alloc/op", "alloc bytes/op"}
45 | err = writer.Write(headers[:])
46 | if err != nil {
47 | log.Fatal("failed to write csv header", err)
48 | }
49 |
50 | for _, benchmarks := range set {
51 | for _, benchmark := range benchmarks {
52 | fmt.Printf("%s\t%s\n", benchmark.Name, benchmark.String())
53 |
54 | name := strings.Split(benchmark.Name, "-")
55 |
56 | columns := make([]string, 5)
57 | columns[0] = name[0]
58 | columns[1] = strconv.FormatFloat(benchmark.NsPerOp, 'f', 2, 64)
59 | columns[2] = strconv.FormatFloat(benchmark.MBPerS, 'f', 2, 64)
60 | columns[3] = strconv.FormatUint(benchmark.AllocsPerOp, 10)
61 | columns[4] = strconv.FormatUint(benchmark.AllocedBytesPerOp, 10)
62 |
63 | err := writer.Write(columns)
64 | if err != nil {
65 | log.Fatal("failed to write to csv file", err)
66 | }
67 | }
68 | }
69 |
70 | // scanner := bufio.NewScanner(file)
71 | // for scanner.Scan() {
72 | // fmt.Println(scanner.Text())
73 | // }
74 |
75 | // if err := scanner.Err(); err != nil {
76 | // log.Fatal(err)
77 | // }
78 | }
79 |
--------------------------------------------------------------------------------
/glide.lock:
--------------------------------------------------------------------------------
1 | hash: 7a0708091f55f8ca674bf8ec325a54863015cee8eedb4d500436a6376c4c0f02
2 | updated: 2018-05-04T18:35:55.360299469-04:00
3 | imports:
4 | - name: code.cloudfoundry.org/go-diodes
5 | version: 361f4b34988b402fbf4d5b744cc9b35959c2ac4e
6 | - name: github.com/cespare/xxhash
7 | version: 5c37fe3735342a2e0d01c87a907579987c8936cc
8 | - name: github.com/codahale/hdrhistogram
9 | version: 3a0bb77429bd3a61596f5e8a3172445844342120
10 | - name: github.com/dchest/siphash
11 | version: 4ebf1de738443ea7f45f02dc394c4df1942a126d
12 | - name: github.com/dgryski/go-farm
13 | version: 2de33835d10275975374b37b2dcfd22c9020a1f5
14 | - name: github.com/dgryski/go-highway
15 | version: 6218551990942dee1a9689662919d4d4601b86ce
16 | - name: github.com/dgryski/go-marvin32
17 | version: b9e766f9d148d0c81c33a69245467d14c11ab3f4
18 | - name: github.com/dgryski/go-metro
19 | version: 280f6062b5bc97ee9b9afe7f2ccb361e59845baa
20 | - name: github.com/dgryski/go-sip13
21 | version: 9cdcd33273afbf1d7d6da5620e103746294dabda
22 | - name: github.com/dgryski/go-spooky
23 | version: ed3d087f40e29d80bfe4d9c1c1f2d4885eb1b82a
24 | - name: github.com/dgryski/go-stadtx
25 | version: 3c3d9b328c24a9b5ecd370654cd6e9d60a85752d
26 | - name: github.com/dgryski/go-t1ha
27 | version: d42c050643ba3f1f03c1563aaccd3b3035098560
28 | - name: github.com/dgryski/trifles
29 | version: fb6752171ea11a9a1a76a7627db6290dbd4ceaf0
30 | subpackages:
31 | - tsip/go
32 | - name: github.com/intel-go/cpuid
33 | version: ec7157e9698925f3ed066c1eeecb7059e0c3422e
34 | - name: github.com/kavu/go_reuseport
35 | version: 5f2ed2cad19279ccb56ddbd38220e6c9803dfe65
36 | - name: github.com/loov/hrtime
37 | version: f50f3e69b115628a5ce4b8946f11a1664e9c92a9
38 | - name: github.com/mailru/easyjson
39 | version: 8b799c424f57fa123fc63a99d6383bc6e4c02578
40 | subpackages:
41 | - buffer
42 | - jlexer
43 | - jwriter
44 | - name: github.com/minio/blake2b-simd
45 | version: 3f5f724cb5b182a5c278d6d3d55b40e7f8c2efb4
46 | - name: github.com/minio/highwayhash
47 | version: 9c7e959d92fc8c6ee2cccdf74ae48685816768e2
48 | - name: github.com/OneOfOne/xxhash
49 | version: 4e9e81466dc37c9fd94ce9ecf42020ef54112203
50 | - name: github.com/onsi/ginkgo
51 | version: 9eda700730cba42af70d53180f9dcce9266bc2bc
52 | - name: github.com/onsi/gomega
53 | version: 003f63b7f4cff3fc95357005358af2de0f5fe152
54 | - name: github.com/opennota/fasthash
55 | version: b619b4c25b8109061ba3c7fec088f9cb289b548c
56 | - name: github.com/pltr/onering
57 | version: 2cfca897df40c101ce9e309824f7ef1b0c56f429
58 | - name: github.com/rbastic/go-zaphod64
59 | version: 51824b1f1f4db0bdeb89c6a53ccdac361e1fc738
60 | - name: github.com/smartystreets/go-disruptor
61 | version: 1d1ef7a0321ccbe402c145b20ec0ad7546ba8f0e
62 | - name: github.com/surge/cityhash
63 | version: cdd6a94144ab18dd21ad865a3aa6837585bffa15
64 | - name: github.com/tidwall/evio
65 | version: cc7a209dcbe6fa42dcc5116377c983fc25f2252a
66 | subpackages:
67 | - internal
68 | - name: github.com/tidwall/fastlane
69 | version: bd0d2fb0d6cc34bd870e991e2659db8e476435da
70 | - name: github.com/tidwall/spinlock
71 | version: 9caf128cdc6499297f5c15f06a50f6aa84e30a19
72 | - name: github.com/tylertreat/hdrhistogram-writer
73 | version: 73b8d31ba571535864ea87c5c3df0361b90a3350
74 | - name: github.com/Workiva/go-datastructures
75 | version: 01f52d4880ca171ab1033bb0ee03cda8e0a31cc3
76 | - name: golang.org/x/net
77 | version: 5f9ae10d9af5b1c89ae6904293b14b064d4ada23
78 | subpackages:
79 | - html/charset
80 | - name: golang.org/x/text
81 | version: f21a4dfb5e38f5895301dc265a8def02365cc3d0
82 | subpackages:
83 | - encoding
84 | - name: golang.org/x/tools
85 | version: 8e070db38e5c55da6a85c81878ab769bf5667848
86 | subpackages:
87 | - benchmark/parse
88 | - name: gopkg.in/yaml.v2
89 | version: 5420a8b6744d3b0345ab293f6fcba19c978f1183
90 | testImports: []
91 |
--------------------------------------------------------------------------------
/glide.yaml:
--------------------------------------------------------------------------------
1 | package: github.com/kellabyte/go-benchmarks
2 | import:
3 | - package: github.com/smartystreets/go-disruptor
4 | - package: github.com/Workiva/go-datastructures
5 | version: ~1.0.46
6 | - package: github.com/OneOfOne/xxhash
7 | version: ~1.2.1
8 | - package: github.com/cespare/xxhash
9 | version: ~1.0.0
10 | - package: github.com/dchest/siphash
11 | version: ~1.1.0
12 | - package: github.com/dgryski/go-farm
13 | - package: github.com/dgryski/go-highway
14 | - package: github.com/dgryski/go-marvin32
15 | - package: github.com/dgryski/go-metro
16 | - package: github.com/dgryski/go-sip13
17 | - package: github.com/dgryski/go-spooky
18 | - package: github.com/dgryski/go-stadtx
19 | - package: github.com/dgryski/go-t1ha
20 | - package: github.com/dgryski/trifles
21 | subpackages:
22 | - tsip/go
23 | - package: github.com/minio/blake2b-simd
24 | - package: github.com/minio/highwayhash
25 | - package: github.com/opennota/fasthash
26 | - package: github.com/rbastic/go-zaphod64
27 | - package: github.com/surge/cityhash
28 | - package: github.com/intel-go/cpuid
29 | - package: golang.org/x/tools
30 | subpackages:
31 | - benchmark/parse
32 | - package: github.com/tidwall/evio
33 | - package: github.com/tidwall/spinlock
34 | - package: code.cloudfoundry.org/go-diodes
35 | - package: github.com/onsi/gomega
36 | version: ~1.3.0
37 | - package: golang.org/x/net
38 | subpackages:
39 | - html/charset
40 | - package: golang.org/x/text
41 | version: ~0.3.0
42 | subpackages:
43 | - encoding
44 | - package: gopkg.in/yaml.v2
45 | version: ~2.2.1
46 | - package: github.com/tidwall/fastlane
47 | - package: github.com/onsi/ginkgo
48 | version: ~1.4.0
49 | - package: github.com/pltr/onering
50 | - package: github.com/codahale/hdrhistogram
51 | - package: github.com/tylertreat/hdrhistogram-writer
52 | - package: github.com/mailru/easyjson
53 | - package: github.com/loov/hrtime
54 |
--------------------------------------------------------------------------------
/hashing/README.md:
--------------------------------------------------------------------------------
1 | This directory includes hashing algorithm benchmarks. The majority of this code comes from [Damian Gryski (@dgryski)]( https://github.com/dgryski/trifles/tree/master/hashbench) with some additions from myself.
2 |
3 | # Setup
4 | ```
5 | Ubuntu Linux
6 | Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz x 20 Cores (40 Hyperthreaded)
7 | L1 Cache: 320 kB
8 | L2 Cache: 2560 kB
9 | L3 Cache: 25600 kB
10 | Memory: 126 GB
11 | ```
12 |
13 | # Results
14 | [](https://github.com/kellabyte/go-benchmarks/raw/master/results/hashing-histogram.png)
15 | [](https://github.com/kellabyte/go-benchmarks/raw/master/results/hashing-multi.png)
16 | ```
17 |
18 | make hashing
19 |
20 | goos: linux
21 | goarch: amd64
22 | pkg: github.com/kellabyte/go-benchmarks/hashing
23 | BenchmarkBlake2B/1-40 3000000 432 ns/op 2.31 MB/s 0 B/op 0 allocs/op
24 | BenchmarkBlake2B/2-40 3000000 404 ns/op 4.95 MB/s 0 B/op 0 allocs/op
25 | BenchmarkBlake2B/4-40 3000000 402 ns/op 9.94 MB/s 0 B/op 0 allocs/op
26 | BenchmarkBlake2B/8-40 3000000 397 ns/op 20.13 MB/s 0 B/op 0 allocs/op
27 | BenchmarkBlake2B/32-40 3000000 384 ns/op 83.33 MB/s 0 B/op 0 allocs/op
28 | BenchmarkBlake2B/64-40 5000000 337 ns/op 189.87 MB/s 0 B/op 0 allocs/op
29 | BenchmarkBlake2B/128-40 5000000 303 ns/op 422.35 MB/s 0 B/op 0 allocs/op
30 | BenchmarkBlake2B/256-40 3000000 508 ns/op 503.54 MB/s 0 B/op 0 allocs/op
31 | BenchmarkBlake2B/512-40 2000000 989 ns/op 517.55 MB/s 0 B/op 0 allocs/op
32 | BenchmarkBlake2B/1024-40 1000000 1660 ns/op 616.83 MB/s 0 B/op 0 allocs/op
33 | BenchmarkBlake2B/4096-40 200000 6195 ns/op 661.11 MB/s 0 B/op 0 allocs/op
34 | BenchmarkBlake2B/8192-40 100000 12368 ns/op 662.31 MB/s 0 B/op 0 allocs/op
35 | BenchmarkCRC32/1-40 100000000 17.1 ns/op 58.36 MB/s 0 B/op 0 allocs/op
36 | BenchmarkCRC32/2-40 100000000 17.0 ns/op 117.42 MB/s 0 B/op 0 allocs/op
37 | BenchmarkCRC32/4-40 100000000 17.2 ns/op 233.15 MB/s 0 B/op 0 allocs/op
38 | BenchmarkCRC32/8-40 100000000 19.0 ns/op 421.71 MB/s 0 B/op 0 allocs/op
39 | BenchmarkCRC32/32-40 100000000 21.6 ns/op 1478.41 MB/s 0 B/op 0 allocs/op
40 | BenchmarkCRC32/64-40 50000000 25.9 ns/op 2474.45 MB/s 0 B/op 0 allocs/op
41 | BenchmarkCRC32/128-40 50000000 33.5 ns/op 3817.90 MB/s 0 B/op 0 allocs/op
42 | BenchmarkCRC32/256-40 20000000 51.9 ns/op 4935.75 MB/s 0 B/op 0 allocs/op
43 | BenchmarkCRC32/512-40 30000000 55.6 ns/op 9216.87 MB/s 0 B/op 0 allocs/op
44 | BenchmarkCRC32/1024-40 20000000 85.8 ns/op 11940.24 MB/s 0 B/op 0 allocs/op
45 | BenchmarkCRC32/4096-40 10000000 206 ns/op 19804.58 MB/s 0 B/op 0 allocs/op
46 | BenchmarkCRC32/8192-40 3000000 406 ns/op 20158.52 MB/s 0 B/op 0 allocs/op
47 | BenchmarkSpooky/1-40 50000000 26.6 ns/op 37.62 MB/s 0 B/op 0 allocs/op
48 | BenchmarkSpooky/2-40 50000000 28.1 ns/op 71.13 MB/s 0 B/op 0 allocs/op
49 | BenchmarkSpooky/4-40 50000000 27.0 ns/op 148.01 MB/s 0 B/op 0 allocs/op
50 | BenchmarkSpooky/8-40 50000000 27.0 ns/op 295.82 MB/s 0 B/op 0 allocs/op
51 | BenchmarkSpooky/32-40 30000000 42.4 ns/op 754.19 MB/s 0 B/op 0 allocs/op
52 | BenchmarkSpooky/64-40 20000000 56.1 ns/op 1140.23 MB/s 0 B/op 0 allocs/op
53 | BenchmarkSpooky/128-40 20000000 80.0 ns/op 1599.27 MB/s 0 B/op 0 allocs/op
54 | BenchmarkSpooky/256-40 10000000 149 ns/op 1709.96 MB/s 0 B/op 0 allocs/op
55 | BenchmarkSpooky/512-40 10000000 207 ns/op 2464.92 MB/s 0 B/op 0 allocs/op
56 | BenchmarkSpooky/1024-40 5000000 354 ns/op 2892.52 MB/s 0 B/op 0 allocs/op
57 | BenchmarkSpooky/4096-40 1000000 1213 ns/op 3374.31 MB/s 0 B/op 0 allocs/op
58 | BenchmarkSpooky/8192-40 500000 2311 ns/op 3544.44 MB/s 0 B/op 0 allocs/op
59 | BenchmarkSipHash/1-40 100000000 18.8 ns/op 53.30 MB/s 0 B/op 0 allocs/op
60 | BenchmarkSipHash/2-40 100000000 19.9 ns/op 100.30 MB/s 0 B/op 0 allocs/op
61 | BenchmarkSipHash/4-40 100000000 19.9 ns/op 200.94 MB/s 0 B/op 0 allocs/op
62 | BenchmarkSipHash/8-40 50000000 24.8 ns/op 322.41 MB/s 0 B/op 0 allocs/op
63 | BenchmarkSipHash/32-40 50000000 35.1 ns/op 910.46 MB/s 0 B/op 0 allocs/op
64 | BenchmarkSipHash/64-40 30000000 53.5 ns/op 1195.72 MB/s 0 B/op 0 allocs/op
65 | BenchmarkSipHash/128-40 20000000 89.7 ns/op 1427.52 MB/s 0 B/op 0 allocs/op
66 | BenchmarkSipHash/256-40 10000000 159 ns/op 1601.99 MB/s 0 B/op 0 allocs/op
67 | BenchmarkSipHash/512-40 5000000 302 ns/op 1690.39 MB/s 0 B/op 0 allocs/op
68 | BenchmarkSipHash/1024-40 3000000 580 ns/op 1762.49 MB/s 0 B/op 0 allocs/op
69 | BenchmarkSipHash/4096-40 1000000 2237 ns/op 1830.93 MB/s 0 B/op 0 allocs/op
70 | BenchmarkSipHash/8192-40 300000 4565 ns/op 1794.19 MB/s 0 B/op 0 allocs/op
71 | BenchmarkFarm/1-40 100000000 14.6 ns/op 68.64 MB/s 0 B/op 0 allocs/op
72 | BenchmarkFarm/2-40 100000000 14.3 ns/op 139.98 MB/s 0 B/op 0 allocs/op
73 | BenchmarkFarm/4-40 100000000 14.9 ns/op 268.36 MB/s 0 B/op 0 allocs/op
74 | BenchmarkFarm/8-40 100000000 17.1 ns/op 467.38 MB/s 0 B/op 0 allocs/op
75 | BenchmarkFarm/32-40 100000000 21.4 ns/op 1493.63 MB/s 0 B/op 0 allocs/op
76 | BenchmarkFarm/64-40 50000000 34.5 ns/op 1855.79 MB/s 0 B/op 0 allocs/op
77 | BenchmarkFarm/128-40 20000000 64.0 ns/op 2001.37 MB/s 0 B/op 0 allocs/op
78 | BenchmarkFarm/256-40 20000000 80.8 ns/op 3169.09 MB/s 0 B/op 0 allocs/op
79 | BenchmarkFarm/512-40 20000000 110 ns/op 4620.44 MB/s 0 B/op 0 allocs/op
80 | BenchmarkFarm/1024-40 10000000 179 ns/op 5705.00 MB/s 0 B/op 0 allocs/op
81 | BenchmarkFarm/4096-40 2000000 560 ns/op 7305.63 MB/s 0 B/op 0 allocs/op
82 | BenchmarkFarm/8192-40 1000000 1184 ns/op 6915.42 MB/s 0 B/op 0 allocs/op
83 | BenchmarkCity/1-40 100000000 12.7 ns/op 78.62 MB/s 0 B/op 0 allocs/op
84 | BenchmarkCity/2-40 100000000 21.8 ns/op 91.79 MB/s 0 B/op 0 allocs/op
85 | BenchmarkCity/4-40 100000000 12.9 ns/op 309.69 MB/s 0 B/op 0 allocs/op
86 | BenchmarkCity/8-40 100000000 13.8 ns/op 580.08 MB/s 0 B/op 0 allocs/op
87 | BenchmarkCity/32-40 100000000 15.5 ns/op 2069.93 MB/s 0 B/op 0 allocs/op
88 | BenchmarkCity/64-40 50000000 33.1 ns/op 1931.42 MB/s 0 B/op 0 allocs/op
89 | BenchmarkCity/128-40 10000000 145 ns/op 882.55 MB/s 0 B/op 0 allocs/op
90 | BenchmarkCity/256-40 10000000 213 ns/op 1198.66 MB/s 0 B/op 0 allocs/op
91 | BenchmarkCity/512-40 5000000 351 ns/op 1454.86 MB/s 0 B/op 0 allocs/op
92 | BenchmarkCity/1024-40 2000000 683 ns/op 1498.08 MB/s 0 B/op 0 allocs/op
93 | BenchmarkCity/4096-40 500000 2609 ns/op 1569.54 MB/s 0 B/op 0 allocs/op
94 | BenchmarkCity/8192-40 300000 4765 ns/op 1719.14 MB/s 0 B/op 0 allocs/op
95 | BenchmarkMetro/1-40 100000000 10.8 ns/op 92.65 MB/s 0 B/op 0 allocs/op
96 | BenchmarkMetro/2-40 100000000 11.0 ns/op 181.82 MB/s 0 B/op 0 allocs/op
97 | BenchmarkMetro/4-40 100000000 10.4 ns/op 382.91 MB/s 0 B/op 0 allocs/op
98 | BenchmarkMetro/8-40 100000000 10.3 ns/op 773.32 MB/s 0 B/op 0 allocs/op
99 | BenchmarkMetro/32-40 100000000 16.6 ns/op 1926.98 MB/s 0 B/op 0 allocs/op
100 | BenchmarkMetro/64-40 100000000 20.1 ns/op 3178.85 MB/s 0 B/op 0 allocs/op
101 | BenchmarkMetro/128-40 50000000 28.0 ns/op 4569.29 MB/s 0 B/op 0 allocs/op
102 | BenchmarkMetro/256-40 30000000 40.9 ns/op 6251.65 MB/s 0 B/op 0 allocs/op
103 | BenchmarkMetro/512-40 20000000 64.3 ns/op 7968.50 MB/s 0 B/op 0 allocs/op
104 | BenchmarkMetro/1024-40 10000000 118 ns/op 8615.76 MB/s 0 B/op 0 allocs/op
105 | BenchmarkMetro/4096-40 3000000 367 ns/op 11152.36 MB/s 0 B/op 0 allocs/op
106 | BenchmarkMetro/8192-40 2000000 717 ns/op 11413.84 MB/s 0 B/op 0 allocs/op
107 | BenchmarkXXHash/1-40 100000000 26.2 ns/op 38.11 MB/s 0 B/op 0 allocs/op
108 | BenchmarkXXHash/2-40 100000000 18.2 ns/op 109.61 MB/s 0 B/op 0 allocs/op
109 | BenchmarkXXHash/4-40 100000000 16.9 ns/op 236.62 MB/s 0 B/op 0 allocs/op
110 | BenchmarkXXHash/8-40 100000000 17.8 ns/op 449.47 MB/s 0 B/op 0 allocs/op
111 | BenchmarkXXHash/32-40 50000000 26.8 ns/op 1194.42 MB/s 0 B/op 0 allocs/op
112 | BenchmarkXXHash/64-40 50000000 28.3 ns/op 2260.40 MB/s 0 B/op 0 allocs/op
113 | BenchmarkXXHash/128-40 50000000 34.6 ns/op 3698.82 MB/s 0 B/op 0 allocs/op
114 | BenchmarkXXHash/256-40 30000000 48.7 ns/op 5253.41 MB/s 0 B/op 0 allocs/op
115 | BenchmarkXXHash/512-40 20000000 71.3 ns/op 7185.10 MB/s 0 B/op 0 allocs/op
116 | BenchmarkXXHash/1024-40 10000000 123 ns/op 8310.38 MB/s 0 B/op 0 allocs/op
117 | BenchmarkXXHash/4096-40 3000000 383 ns/op 10687.60 MB/s 0 B/op 0 allocs/op
118 | BenchmarkXXHash/8192-40 2000000 1410 ns/op 5806.01 MB/s 0 B/op 0 allocs/op
119 | BenchmarkXXFast/1-40 200000000 8.84 ns/op 113.10 MB/s 0 B/op 0 allocs/op
120 | BenchmarkXXFast/2-40 100000000 10.9 ns/op 183.18 MB/s 0 B/op 0 allocs/op
121 | BenchmarkXXFast/4-40 200000000 9.00 ns/op 444.52 MB/s 0 B/op 0 allocs/op
122 | BenchmarkXXFast/8-40 100000000 10.4 ns/op 770.04 MB/s 0 B/op 0 allocs/op
123 | BenchmarkXXFast/32-40 100000000 17.1 ns/op 1871.43 MB/s 0 B/op 0 allocs/op
124 | BenchmarkXXFast/64-40 100000000 21.3 ns/op 3009.02 MB/s 0 B/op 0 allocs/op
125 | BenchmarkXXFast/128-40 50000000 26.4 ns/op 4848.22 MB/s 0 B/op 0 allocs/op
126 | BenchmarkXXFast/256-40 30000000 41.2 ns/op 6211.41 MB/s 0 B/op 0 allocs/op
127 | BenchmarkXXFast/512-40 20000000 61.8 ns/op 8278.66 MB/s 0 B/op 0 allocs/op
128 | BenchmarkXXFast/1024-40 20000000 108 ns/op 9426.90 MB/s 0 B/op 0 allocs/op
129 | BenchmarkXXFast/4096-40 3000000 360 ns/op 11368.22 MB/s 0 B/op 0 allocs/op
130 | BenchmarkXXFast/8192-40 2000000 694 ns/op 11793.99 MB/s 0 B/op 0 allocs/op
131 | BenchmarkFasthash/1-40 200000000 8.70 ns/op 115.00 MB/s 0 B/op 0 allocs/op
132 | BenchmarkFasthash/2-40 100000000 10.2 ns/op 196.27 MB/s 0 B/op 0 allocs/op
133 | BenchmarkFasthash/4-40 100000000 10.7 ns/op 374.26 MB/s 0 B/op 0 allocs/op
134 | BenchmarkFasthash/8-40 200000000 8.34 ns/op 959.39 MB/s 0 B/op 0 allocs/op
135 | BenchmarkFasthash/32-40 100000000 12.6 ns/op 2547.16 MB/s 0 B/op 0 allocs/op
136 | BenchmarkFasthash/64-40 100000000 17.4 ns/op 3668.86 MB/s 0 B/op 0 allocs/op
137 | BenchmarkFasthash/128-40 50000000 29.2 ns/op 4383.09 MB/s 0 B/op 0 allocs/op
138 | BenchmarkFasthash/256-40 30000000 50.5 ns/op 5067.97 MB/s 0 B/op 0 allocs/op
139 | BenchmarkFasthash/512-40 20000000 97.8 ns/op 5236.04 MB/s 0 B/op 0 allocs/op
140 | BenchmarkFasthash/1024-40 10000000 182 ns/op 5603.64 MB/s 0 B/op 0 allocs/op
141 | BenchmarkFasthash/4096-40 2000000 737 ns/op 5554.83 MB/s 0 B/op 0 allocs/op
142 | BenchmarkFasthash/8192-40 1000000 1404 ns/op 5832.26 MB/s 0 B/op 0 allocs/op
143 | BenchmarkHighway/1-40 30000000 43.8 ns/op 22.84 MB/s 0 B/op 0 allocs/op
144 | BenchmarkHighway/2-40 30000000 44.8 ns/op 44.64 MB/s 0 B/op 0 allocs/op
145 | BenchmarkHighway/4-40 30000000 43.9 ns/op 91.17 MB/s 0 B/op 0 allocs/op
146 | BenchmarkHighway/8-40 30000000 42.1 ns/op 190.10 MB/s 0 B/op 0 allocs/op
147 | BenchmarkHighway/32-40 50000000 38.2 ns/op 837.09 MB/s 0 B/op 0 allocs/op
148 | BenchmarkHighway/64-40 30000000 44.1 ns/op 1449.86 MB/s 0 B/op 0 allocs/op
149 | BenchmarkHighway/128-40 30000000 53.5 ns/op 2391.34 MB/s 0 B/op 0 allocs/op
150 | BenchmarkHighway/256-40 20000000 72.0 ns/op 3555.82 MB/s 0 B/op 0 allocs/op
151 | BenchmarkHighway/512-40 20000000 106 ns/op 4798.60 MB/s 0 B/op 0 allocs/op
152 | BenchmarkHighway/1024-40 10000000 185 ns/op 5529.40 MB/s 0 B/op 0 allocs/op
153 | BenchmarkHighway/4096-40 2000000 640 ns/op 6393.10 MB/s 0 B/op 0 allocs/op
154 | BenchmarkHighway/8192-40 1000000 1237 ns/op 6621.30 MB/s 0 B/op 0 allocs/op
155 | BenchmarkMinioHighway/1-40 20000000 82.1 ns/op 12.18 MB/s 0 B/op 0 allocs/op
156 | BenchmarkMinioHighway/2-40 20000000 76.7 ns/op 26.07 MB/s 0 B/op 0 allocs/op
157 | BenchmarkMinioHighway/4-40 20000000 78.0 ns/op 51.26 MB/s 0 B/op 0 allocs/op
158 | BenchmarkMinioHighway/8-40 20000000 81.0 ns/op 98.74 MB/s 0 B/op 0 allocs/op
159 | BenchmarkMinioHighway/32-40 20000000 56.0 ns/op 571.56 MB/s 0 B/op 0 allocs/op
160 | BenchmarkMinioHighway/64-40 20000000 60.3 ns/op 1061.49 MB/s 0 B/op 0 allocs/op
161 | BenchmarkMinioHighway/128-40 20000000 67.6 ns/op 1892.81 MB/s 0 B/op 0 allocs/op
162 | BenchmarkMinioHighway/256-40 20000000 81.9 ns/op 3127.35 MB/s 0 B/op 0 allocs/op
163 | BenchmarkMinioHighway/512-40 20000000 110 ns/op 4618.04 MB/s 0 B/op 0 allocs/op
164 | BenchmarkMinioHighway/1024-40 10000000 168 ns/op 6059.25 MB/s 0 B/op 0 allocs/op
165 | BenchmarkMinioHighway/4096-40 2000000 551 ns/op 7431.68 MB/s 0 B/op 0 allocs/op
166 | BenchmarkMinioHighway/8192-40 2000000 1002 ns/op 8167.70 MB/s 0 B/op 0 allocs/op
167 | BenchmarkMarvin32/1-40 200000000 8.77 ns/op 114.02 MB/s 0 B/op 0 allocs/op
168 | BenchmarkMarvin32/2-40 100000000 10.1 ns/op 197.40 MB/s 0 B/op 0 allocs/op
169 | BenchmarkMarvin32/4-40 100000000 10.9 ns/op 367.15 MB/s 0 B/op 0 allocs/op
170 | BenchmarkMarvin32/8-40 100000000 12.1 ns/op 662.28 MB/s 0 B/op 0 allocs/op
171 | BenchmarkMarvin32/32-40 50000000 23.4 ns/op 1366.20 MB/s 0 B/op 0 allocs/op
172 | BenchmarkMarvin32/64-40 30000000 41.4 ns/op 1546.61 MB/s 0 B/op 0 allocs/op
173 | BenchmarkMarvin32/128-40 20000000 70.7 ns/op 1810.33 MB/s 0 B/op 0 allocs/op
174 | BenchmarkMarvin32/256-40 10000000 129 ns/op 1970.16 MB/s 0 B/op 0 allocs/op
175 | BenchmarkMarvin32/512-40 5000000 261 ns/op 1960.62 MB/s 0 B/op 0 allocs/op
176 | BenchmarkMarvin32/1024-40 3000000 506 ns/op 2020.95 MB/s 0 B/op 0 allocs/op
177 | BenchmarkMarvin32/4096-40 1000000 1981 ns/op 2066.65 MB/s 0 B/op 0 allocs/op
178 | BenchmarkMarvin32/8192-40 300000 4108 ns/op 1993.82 MB/s 0 B/op 0 allocs/op
179 | BenchmarkSip13Hash/1-40 100000000 14.6 ns/op 68.42 MB/s 0 B/op 0 allocs/op
180 | BenchmarkSip13Hash/2-40 100000000 15.6 ns/op 128.26 MB/s 0 B/op 0 allocs/op
181 | BenchmarkSip13Hash/4-40 100000000 16.6 ns/op 240.55 MB/s 0 B/op 0 allocs/op
182 | BenchmarkSip13Hash/8-40 100000000 18.0 ns/op 443.79 MB/s 0 B/op 0 allocs/op
183 | BenchmarkSip13Hash/32-40 50000000 25.9 ns/op 1237.18 MB/s 0 B/op 0 allocs/op
184 | BenchmarkSip13Hash/64-40 50000000 32.9 ns/op 1944.82 MB/s 0 B/op 0 allocs/op
185 | BenchmarkSip13Hash/128-40 30000000 52.7 ns/op 2427.80 MB/s 0 B/op 0 allocs/op
186 | BenchmarkSip13Hash/256-40 20000000 92.7 ns/op 2761.65 MB/s 0 B/op 0 allocs/op
187 | BenchmarkSip13Hash/512-40 10000000 196 ns/op 2601.43 MB/s 0 B/op 0 allocs/op
188 | BenchmarkSip13Hash/1024-40 5000000 466 ns/op 2193.41 MB/s 0 B/op 0 allocs/op
189 | BenchmarkSip13Hash/4096-40 1000000 1189 ns/op 3444.00 MB/s 0 B/op 0 allocs/op
190 | BenchmarkSip13Hash/8192-40 500000 2542 ns/op 3221.56 MB/s 0 B/op 0 allocs/op
191 | BenchmarkFNV1/1-40 50000000 32.0 ns/op 31.24 MB/s 8 B/op 1 allocs/op
192 | BenchmarkFNV1/2-40 50000000 33.4 ns/op 59.79 MB/s 8 B/op 1 allocs/op
193 | BenchmarkFNV1/4-40 50000000 33.1 ns/op 120.92 MB/s 8 B/op 1 allocs/op
194 | BenchmarkFNV1/8-40 50000000 35.6 ns/op 224.76 MB/s 8 B/op 1 allocs/op
195 | BenchmarkFNV1/32-40 20000000 68.2 ns/op 469.43 MB/s 8 B/op 1 allocs/op
196 | BenchmarkFNV1/64-40 20000000 110 ns/op 581.02 MB/s 8 B/op 1 allocs/op
197 | BenchmarkFNV1/128-40 10000000 208 ns/op 612.65 MB/s 8 B/op 1 allocs/op
198 | BenchmarkFNV1/256-40 5000000 388 ns/op 659.64 MB/s 8 B/op 1 allocs/op
199 | BenchmarkFNV1/512-40 2000000 725 ns/op 706.18 MB/s 8 B/op 1 allocs/op
200 | BenchmarkFNV1/1024-40 1000000 1405 ns/op 728.41 MB/s 8 B/op 1 allocs/op
201 | BenchmarkFNV1/4096-40 200000 5181 ns/op 790.51 MB/s 8 B/op 1 allocs/op
202 | BenchmarkFNV1/8192-40 200000 10554 ns/op 776.18 MB/s 8 B/op 1 allocs/op
203 | BenchmarkT1ha/1-40 50000000 22.9 ns/op 43.59 MB/s 0 B/op 0 allocs/op
204 | BenchmarkT1ha/2-40 50000000 23.6 ns/op 84.62 MB/s 0 B/op 0 allocs/op
205 | BenchmarkT1ha/4-40 50000000 23.4 ns/op 170.69 MB/s 0 B/op 0 allocs/op
206 | BenchmarkT1ha/8-40 50000000 23.9 ns/op 334.82 MB/s 0 B/op 0 allocs/op
207 | BenchmarkT1ha/32-40 30000000 41.9 ns/op 763.55 MB/s 0 B/op 0 allocs/op
208 | BenchmarkT1ha/64-40 50000000 26.0 ns/op 2461.05 MB/s 0 B/op 0 allocs/op
209 | BenchmarkT1ha/128-40 30000000 38.8 ns/op 3300.28 MB/s 0 B/op 0 allocs/op
210 | BenchmarkT1ha/256-40 20000000 58.8 ns/op 4355.53 MB/s 0 B/op 0 allocs/op
211 | BenchmarkT1ha/512-40 20000000 103 ns/op 4946.42 MB/s 0 B/op 0 allocs/op
212 | BenchmarkT1ha/1024-40 10000000 193 ns/op 5281.40 MB/s 0 B/op 0 allocs/op
213 | BenchmarkT1ha/4096-40 2000000 696 ns/op 5880.08 MB/s 0 B/op 0 allocs/op
214 | BenchmarkT1ha/8192-40 1000000 1409 ns/op 5811.66 MB/s 0 B/op 0 allocs/op
215 | BenchmarkZaphod64/1-40 100000000 17.2 ns/op 58.25 MB/s 0 B/op 0 allocs/op
216 | BenchmarkZaphod64/2-40 100000000 18.2 ns/op 110.06 MB/s 0 B/op 0 allocs/op
217 | BenchmarkZaphod64/4-40 100000000 17.1 ns/op 234.22 MB/s 0 B/op 0 allocs/op
218 | BenchmarkZaphod64/8-40 100000000 17.3 ns/op 461.46 MB/s 0 B/op 0 allocs/op
219 | BenchmarkZaphod64/32-40 50000000 31.8 ns/op 1006.25 MB/s 0 B/op 0 allocs/op
220 | BenchmarkZaphod64/64-40 30000000 47.4 ns/op 1351.04 MB/s 0 B/op 0 allocs/op
221 | BenchmarkZaphod64/128-40 20000000 73.4 ns/op 1742.76 MB/s 0 B/op 0 allocs/op
222 | BenchmarkZaphod64/256-40 10000000 138 ns/op 1853.48 MB/s 0 B/op 0 allocs/op
223 | BenchmarkZaphod64/512-40 5000000 283 ns/op 1807.21 MB/s 0 B/op 0 allocs/op
224 | BenchmarkZaphod64/1024-40 3000000 800 ns/op 1278.87 MB/s 0 B/op 0 allocs/op
225 | BenchmarkZaphod64/4096-40 1000000 1862 ns/op 2198.98 MB/s 0 B/op 0 allocs/op
226 | BenchmarkZaphod64/8192-40 300000 3909 ns/op 2095.40 MB/s 0 B/op 0 allocs/op
227 | BenchmarkStadtx/1-40 100000000 12.4 ns/op 80.77 MB/s 0 B/op 0 allocs/op
228 | BenchmarkStadtx/2-40 100000000 11.3 ns/op 177.13 MB/s 0 B/op 0 allocs/op
229 | BenchmarkStadtx/4-40 100000000 11.9 ns/op 335.28 MB/s 0 B/op 0 allocs/op
230 | BenchmarkStadtx/8-40 100000000 12.8 ns/op 623.57 MB/s 0 B/op 0 allocs/op
231 | BenchmarkStadtx/32-40 100000000 17.3 ns/op 1846.74 MB/s 0 B/op 0 allocs/op
232 | BenchmarkStadtx/64-40 100000000 20.1 ns/op 3186.10 MB/s 0 B/op 0 allocs/op
233 | BenchmarkStadtx/128-40 50000000 39.9 ns/op 3207.58 MB/s 0 B/op 0 allocs/op
234 | BenchmarkStadtx/256-40 30000000 39.1 ns/op 6543.57 MB/s 0 B/op 0 allocs/op
235 | BenchmarkStadtx/512-40 20000000 63.8 ns/op 8019.79 MB/s 0 B/op 0 allocs/op
236 | BenchmarkStadtx/1024-40 10000000 113 ns/op 9041.50 MB/s 0 B/op 0 allocs/op
237 | BenchmarkStadtx/4096-40 3000000 381 ns/op 10728.96 MB/s 0 B/op 0 allocs/op
238 | BenchmarkStadtx/8192-40 2000000 724 ns/op 11310.24 MB/s 0 B/op 0 allocs/op
239 | BenchmarkTsip/1-40 100000000 12.0 ns/op 83.13 MB/s 0 B/op 0 allocs/op
240 | BenchmarkTsip/2-40 100000000 12.5 ns/op 159.66 MB/s 0 B/op 0 allocs/op
241 | BenchmarkTsip/4-40 100000000 12.7 ns/op 314.24 MB/s 0 B/op 0 allocs/op
242 | BenchmarkTsip/8-40 100000000 13.6 ns/op 589.51 MB/s 0 B/op 0 allocs/op
243 | BenchmarkTsip/32-40 100000000 18.8 ns/op 1701.80 MB/s 0 B/op 0 allocs/op
244 | BenchmarkTsip/64-40 50000000 27.2 ns/op 2351.30 MB/s 0 B/op 0 allocs/op
245 | BenchmarkTsip/128-40 30000000 44.4 ns/op 2879.73 MB/s 0 B/op 0 allocs/op
246 | BenchmarkTsip/256-40 20000000 78.3 ns/op 3271.46 MB/s 0 B/op 0 allocs/op
247 | BenchmarkTsip/512-40 10000000 145 ns/op 3514.80 MB/s 0 B/op 0 allocs/op
248 | BenchmarkTsip/1024-40 5000000 277 ns/op 3690.44 MB/s 0 B/op 0 allocs/op
249 | BenchmarkTsip/4096-40 1000000 1044 ns/op 3920.20 MB/s 0 B/op 0 allocs/op
250 | BenchmarkTsip/8192-40 1000000 2154 ns/op 3801.60 MB/s 0 B/op 0 allocs/op
251 | PASS
252 | ok github.com/kellabyte/go-benchmarks/hashing 402.919s
253 | ```
--------------------------------------------------------------------------------
/hashing/benchmark_test.go:
--------------------------------------------------------------------------------
1 | package hashing
2 |
3 | import (
4 | "encoding/binary"
5 | "encoding/hex"
6 | "hash/crc32"
7 | "hash/fnv"
8 | "strconv"
9 | "testing"
10 |
11 | xxhash "github.com/OneOfOne/xxhash"
12 | xxhashfast "github.com/cespare/xxhash"
13 | dchestsip "github.com/dchest/siphash"
14 | "github.com/dgryski/go-farm"
15 | highway "github.com/dgryski/go-highway"
16 | "github.com/dgryski/go-marvin32"
17 | "github.com/dgryski/go-metro"
18 | "github.com/dgryski/go-sip13"
19 | "github.com/dgryski/go-spooky"
20 | "github.com/dgryski/go-stadtx"
21 | "github.com/dgryski/go-t1ha"
22 | tsip "github.com/dgryski/trifles/tsip/go"
23 | blake2b "github.com/minio/blake2b-simd"
24 | miniohighway "github.com/minio/highwayhash"
25 | "github.com/opennota/fasthash"
26 | "github.com/rbastic/go-zaphod64"
27 | "github.com/surge/cityhash"
28 | )
29 |
30 | // Written in 2012 by Dmitry Chestnykh.
31 | // Expanded to include multiple hash functions by Damian Gryski, 2015.
32 | //
33 | // To the extent possible under law, the author have dedicated all copyright
34 | // and related and neighboring rights to this software to the public domain
35 | // worldwide. This software is distributed without any warranty.
36 | // http://creativecommons.org/publicdomain/zero/1.0/
37 |
38 | var (
39 | key0, key1 uint64
40 | buf = make([]byte, 8<<10)
41 | crc32Table = crc32.MakeTable(crc32.Castagnoli)
42 | minioHighwayKey, _ = hex.DecodeString("000102030405060708090A0B0C0D0E0FF0E0D0C0B0A090807060504030201000")
43 | )
44 |
45 | var hblake2b = func(k []byte) uint64 {
46 | sum := blake2b.Sum256(k)
47 | return binary.LittleEndian.Uint64(sum[:8])
48 | }
49 |
50 | func BenchmarkBlake2B(b *testing.B) { benchmarkHash(b, "Blake2B", hblake2b) }
51 |
52 | var hcrc32 = func(k []byte) uint64 { return uint64(crc32.Checksum(k, crc32Table)) }
53 |
54 | func BenchmarkCRC32(b *testing.B) { benchmarkHash(b, "CRC32", hcrc32) }
55 |
56 | var hspooky = func(k []byte) uint64 { return spooky.Hash64(k) }
57 |
58 | func BenchmarkSpooky(b *testing.B) { benchmarkHash(b, "Spooky", hspooky) }
59 |
60 | var hsiphash = func(k []byte) uint64 { return dchestsip.Hash(0, 0, k) }
61 |
62 | func BenchmarkSipHash(b *testing.B) { benchmarkHash(b, "SipHash", hsiphash) }
63 |
64 | var hfarm = func(k []byte) uint64 { return farm.Hash64(k) }
65 |
66 | func BenchmarkFarm(b *testing.B) { benchmarkHash(b, "Farm", hfarm) }
67 |
68 | var hcity = func(k []byte) uint64 { return cityhash.CityHash64(k, uint32(len(k))) }
69 |
70 | func BenchmarkCity(b *testing.B) { benchmarkHash(b, "City", hcity) }
71 |
72 | var hmetro = func(k []byte) uint64 { return metro.Hash64(k, 0) }
73 |
74 | func BenchmarkMetro(b *testing.B) { benchmarkHash(b, "Metro", hmetro) }
75 |
76 | var hxxhash = func(k []byte) uint64 { return xxhash.Checksum64(k) }
77 |
78 | func BenchmarkXXHash(b *testing.B) { benchmarkHash(b, "XXHash", hxxhash) }
79 |
80 | var hxxhashfast = func(k []byte) uint64 { return xxhashfast.Sum64(k) }
81 |
82 | func BenchmarkXXFast(b *testing.B) { benchmarkHash(b, "XXFast", hxxhashfast) }
83 |
84 | var fsthash = func(k []byte) uint64 { return fasthash.Hash64(0, k) }
85 |
86 | func BenchmarkFasthash(b *testing.B) { benchmarkHash(b, "Fasthash", fsthash) }
87 |
88 | var high = func(k []byte) uint64 { return highway.Hash(highway.Lanes{}, k) }
89 |
90 | func BenchmarkHighway(b *testing.B) { benchmarkHash(b, "Highway", high) }
91 |
92 | var hminiohighway = func(k []byte) uint64 { return miniohighway.Sum64(k, minioHighwayKey) }
93 |
94 | func BenchmarkMinioHighway(b *testing.B) { benchmarkHash(b, "MinioHighway", hminiohighway) }
95 |
96 | var marvin = func(k []byte) uint64 { return uint64(marvin32.Sum32(0, k)) }
97 |
98 | func BenchmarkMarvin32(b *testing.B) { benchmarkHash(b, "Marvin32", marvin) }
99 |
100 | var sip13hash = func(k []byte) uint64 { return sip13.Sum64(0, 0, k) }
101 |
102 | func BenchmarkSip13Hash(b *testing.B) { benchmarkHash(b, "Sip13", sip13hash) }
103 |
104 | var fnv64 = func(k []byte) uint64 {
105 | h := fnv.New64a()
106 | h.Write(k)
107 | return h.Sum64()
108 | }
109 |
110 | func BenchmarkFNV1(b *testing.B) { benchmarkHash(b, "fnv1a", fnv64) }
111 |
112 | var ht1ha = func(k []byte) uint64 { return t1ha.Sum64(k, 0) }
113 |
114 | func BenchmarkT1ha(b *testing.B) { benchmarkHash(b, "T1ha", ht1ha) }
115 |
116 | var zaphodSeed zaphod64.State
117 |
118 | var hzaphod64 = func(k []byte) uint64 { return uint64(zaphod64.HashWithState(&zaphodSeed, k, uint64(len(k)))) }
119 |
120 | func BenchmarkZaphod64(b *testing.B) { benchmarkHash(b, "Zaphod64", hzaphod64) }
121 |
122 | var stadtxState stadtx.State
123 |
124 | var hstadtx = func(k []byte) uint64 { return stadtx.Hash(&stadtxState, k) }
125 |
126 | func BenchmarkStadtx(b *testing.B) { benchmarkHash(b, "Stadtx", hstadtx) }
127 |
128 | var htsip = func(k []byte) uint64 { return tsip.HashASM(0, 0, k) }
129 |
130 | func BenchmarkTsip(b *testing.B) { benchmarkHash(b, "Tsip", htsip) }
131 |
132 | func benchmarkHash(b *testing.B, str string, h func([]byte) uint64) {
133 | var sizes = []int{1, 2, 4, 8, 32, 64, 128, 256, 512, 1024, 4096, 8192}
134 | for _, n := range sizes {
135 | b.Run(strconv.Itoa(n), func(b *testing.B) { benchmarkHashn(b, int64(n), h) })
136 | }
137 | }
138 |
139 | var total uint64
140 |
141 | func benchmarkHashn(b *testing.B, size int64, h func([]byte) uint64) {
142 | b.SetBytes(size)
143 | for i := 0; i < b.N; i++ {
144 | total += h(buf[:size])
145 | }
146 | }
147 |
--------------------------------------------------------------------------------
/http/evio.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "fmt"
5 | "log"
6 | "os"
7 | "runtime"
8 |
9 | "github.com/tidwall/evio"
10 | )
11 |
12 | func main() {
13 | logging := false
14 | if len(os.Args) > 1 {
15 | if os.Args[1] == "--debug" {
16 | logging = true
17 | }
18 | }
19 |
20 | const responseString = "HTTP/1.1 204\r\n\r\n"
21 | responseBuffer := []byte(responseString)
22 |
23 | buffer := make([]byte, 0, len(responseBuffer)*10000)
24 | for i := 0; i < 10000; i++ {
25 | buffer = append(buffer, responseBuffer...)
26 | }
27 |
28 | var events evio.Events
29 | events.Serving = func(s evio.Server) (action evio.Action) {
30 | log.Printf("serving %s\n", s.Addrs[0])
31 | return
32 | }
33 | events.Opened = func(id int, info evio.Info) (out []byte, opts evio.Options, ctx interface{}, action evio.Action) {
34 | // Reuse the input buffer on Data callbacks to avoid unneeded alloc.
35 | opts.ReuseInputBuffer = true
36 | return
37 | }
38 | events.Data = func(id int, ctx interface{}, in []byte) (out []byte, action evio.Action) {
39 | if logging {
40 | fmt.Printf("%q\n", in)
41 | }
42 | numberOfRequests := len(in) / 40
43 | out = buffer[:numberOfRequests*len(responseBuffer)]
44 | return
45 | }
46 | events.NumLoops = runtime.NumCPU() / 2
47 | evio.Serve(events, "tcp://0.0.0.0:8000?reuseport=true")
48 | }
49 |
--------------------------------------------------------------------------------
/http/parse_test.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "crypto/rand"
5 | "encoding/binary"
6 | "testing"
7 | )
8 |
9 | const requests = "PUT / HTTP/1.0\r\n"
10 |
11 | // createHTTPReqyestBuffer creates a HTTP request buffer payload with the following layout.
12 | //
13 | // PUT / HTTP/1.0\r\n[uint32][uint32][key-bytes][value-bytes]
14 | func createHTTPRequestBuffer(key []byte, value []byte) []byte {
15 | lengthOfRequestHeader := len(requests)
16 | lengthOfKey := len(key)
17 | lengthOfValue := len(value)
18 | buffer := make([]byte, lengthOfRequestHeader+4+4+lengthOfKey+lengthOfValue)
19 |
20 | offset := 0
21 | copy(buffer[offset:lengthOfRequestHeader], requests)
22 | offset += lengthOfRequestHeader
23 | binary.LittleEndian.PutUint32(buffer[offset:offset+4], uint32(lengthOfKey))
24 | offset += 4
25 | binary.LittleEndian.PutUint32(buffer[offset:offset+4], uint32(lengthOfValue))
26 | offset += 4
27 | copy(buffer[offset:], key)
28 | offset += len(key)
29 | copy(buffer[offset:], value)
30 |
31 | return buffer
32 | }
33 |
34 | func createRandomKeyValue(keyLength int, valueLength int) ([]byte, []byte) {
35 | key := make([]byte, keyLength)
36 | value := make([]byte, valueLength)
37 | rand.Read(key)
38 | rand.Read(value)
39 | return key, value
40 | }
41 |
42 | func createRequests(numberOfRequests int, keyLength int, valueLength int) []byte {
43 | lengthOfRequestHeaders := len(requests) * numberOfRequests
44 | lengthOfOffsets := (4 + 4) * numberOfRequests
45 | lengthOfKeys := keyLength * numberOfRequests
46 | lengthOfValues := valueLength * numberOfRequests
47 | lengthOfBuffer := lengthOfRequestHeaders + lengthOfOffsets + lengthOfKeys + lengthOfValues
48 | buffer := make([]byte, lengthOfBuffer)
49 |
50 | offset := 0
51 | for i := 0; i < numberOfRequests; i++ {
52 | key, value := createRandomKeyValue(16, 64)
53 | request := createHTTPRequestBuffer(key, value)
54 | copy(buffer[offset:lengthOfBuffer], request)
55 | offset += len(request)
56 | }
57 | return buffer
58 | }
59 |
60 | // BenchmarkFixedParser1000 splits b.N desired iterations from gobench (example: 200000000)
61 | // into 1000 batches of runs so that we can parse large chunks of requests and invalidate
62 | // CPU caches correctly without running out of memory trying to allocate 200000000 requests.
63 | func BenchmarkFixedParser1000(b *testing.B) {
64 | benchmarkFixedParser(b, b.N, 1000, 16, 64)
65 | }
66 |
67 | func benchmarkFixedParser(b *testing.B, numberOfRequests int, splitSize int, keyLength int, valueLength int) {
68 | buffer := createRequests(numberOfRequests/splitSize, keyLength, valueLength)
69 | b.ResetTimer()
70 |
71 | for c := 0; c < splitSize; c++ {
72 | offset := 0
73 | for i := 0; i < numberOfRequests/splitSize; i++ {
74 | offset += 16
75 | lengthOfKey := int(binary.LittleEndian.Uint32(buffer[offset : offset+4]))
76 | offset += +4
77 | lengthOfValue := int(binary.LittleEndian.Uint32(buffer[offset : offset+4]))
78 | offset += 4
79 | key := buffer[offset : offset+lengthOfKey]
80 | offset += lengthOfKey
81 | value := buffer[offset : offset+lengthOfValue]
82 | offset += lengthOfValue
83 |
84 | _ = key
85 | _ = value
86 | b.SetBytes(1)
87 | }
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/json/README.md:
--------------------------------------------------------------------------------
1 | This directory includes json benchmarks.
2 |
3 | # Setup
4 | ```
5 | Ubuntu Linux
6 | Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz x 20 Cores (40 Hyperthreaded)
7 | L1 Cache: 320 kB
8 | L2 Cache: 2560 kB
9 | L3 Cache: 25600 kB
10 | Memory: 126 GB
11 | ```
12 |
13 | This benchmark measures encoding and decoding a small JSON document and a larger JSON document. An example of the small document is as follows.
14 | ```
15 | {
16 | "hashtags": [
17 | {
18 | "indices": [
19 | 5,
20 | 10
21 | ],
22 | "text": "some-text"
23 | }
24 | ],
25 | "urls": [
26 |
27 | ],
28 | "user_mentions": [
29 |
30 | ]
31 | }
32 | ```
33 |
34 | An example of the large document can be [found here](https://github.com/kellabyte/go-benchmarks/blob/master/json/example.json)
35 |
36 | # Results
37 | [](https://github.com/kellabyte/go-benchmarks/raw/master/results/json-multi.png)
38 |
39 | ```
40 | make json
41 |
42 | goos: darwin
43 | goarch: amd64
44 | pkg: github.com/euskadi31/go-benchmarks/json
45 | BenchmarkEasyjsonUnmarshalLargeData-8 30000 50991 ns/op 316.74 MB/s 9792 B/op 128 allocs/op
46 | BenchmarkEasyjsonUnmarshalSmallData-8 3000000 629 ns/op 130.18 MB/s 128 B/op 3 allocs/op
47 | BenchmarkEasyjsonMarshalLargeData-8 100000 17635 ns/op 510.17 MB/s 10369 B/op 10 allocs/op
48 | BenchmarkEasyjsonMarshalSmallData-8 5000000 307 ns/op 263.41 MB/s 240 B/op 2 allocs/op
49 | BenchmarkStdUnmarshalLargeData-8 10000 169305 ns/op 95.40 MB/s 10720 B/op 140 allocs/op
50 | BenchmarkStdUnmarshalSmallData-8 1000000 1805 ns/op 45.42 MB/s 608 B/op 11 allocs/op
51 | BenchmarkStdMarshalLargeData-8 20000 82255 ns/op 109.38 MB/s 20291 B/op 17 allocs/op
52 | BenchmarkStdMarshalSmallData-8 1000000 1372 ns/op 59.00 MB/s 552 B/op 7 allocs/op
53 | PASS
54 | ok github.com/euskadi31/go-benchmarks/json 15.687s
55 | ```
56 |
--------------------------------------------------------------------------------
/json/data.go:
--------------------------------------------------------------------------------
1 | package json
2 |
3 | import (
4 | "encoding/json"
5 | "io/ioutil"
6 | )
7 |
8 | //go:generate easyjson -all data.go
9 |
10 | var largeStructText, _ = ioutil.ReadFile("example.json")
11 | var largeStructData LargeStruct
12 |
13 | var smallStructText = []byte(`{"hashtags":[{"indices":[5, 10],"text":"some-text"}],"urls":[],"user_mentions":[]}`)
14 | var smallStructData = Entities{
15 | Hashtags: []Hashtag{{Indices: []int{5, 10}, Text: "some-text"}},
16 | Urls: []*string{},
17 | UserMentions: []*string{},
18 | }
19 |
20 | func init() {
21 | if err := json.Unmarshal(largeStructText, &largeStructData); err != nil {
22 | panic(err)
23 | }
24 | }
25 |
26 | type SearchMetadata struct {
27 | CompletedIn float64 `json:"completed_in"`
28 | Count int `json:"count"`
29 | MaxID int64 `json:"max_id"`
30 | MaxIDStr string `json:"max_id_str"`
31 | NextResults string `json:"next_results"`
32 | Query string `json:"query"`
33 | RefreshURL string `json:"refresh_url"`
34 | SinceID int64 `json:"since_id"`
35 | SinceIDStr string `json:"since_id_str"`
36 | }
37 |
38 | type Hashtag struct {
39 | Indices []int `json:"indices"`
40 | Text string `json:"text"`
41 | }
42 |
43 | //easyjson:json
44 | type Entities struct {
45 | Hashtags []Hashtag `json:"hashtags"`
46 | Urls []*string `json:"urls"`
47 | UserMentions []*string `json:"user_mentions"`
48 | }
49 |
50 | type UserEntityDescription struct {
51 | Urls []*string `json:"urls"`
52 | }
53 |
54 | type URL struct {
55 | ExpandedURL *string `json:"expanded_url"`
56 | Indices []int `json:"indices"`
57 | URL string `json:"url"`
58 | }
59 |
60 | type UserEntityURL struct {
61 | Urls []URL `json:"urls"`
62 | }
63 |
64 | type UserEntities struct {
65 | Description UserEntityDescription `json:"description"`
66 | URL UserEntityURL `json:"url"`
67 | }
68 |
69 | type User struct {
70 | ContributorsEnabled bool `json:"contributors_enabled"`
71 | CreatedAt string `json:"created_at"`
72 | DefaultProfile bool `json:"default_profile"`
73 | DefaultProfileImage bool `json:"default_profile_image"`
74 | Description string `json:"description"`
75 | Entities UserEntities `json:"entities"`
76 | FavouritesCount int `json:"favourites_count"`
77 | FollowRequestSent *string `json:"follow_request_sent"`
78 | FollowersCount int `json:"followers_count"`
79 | Following *string `json:"following"`
80 | FriendsCount int `json:"friends_count"`
81 | GeoEnabled bool `json:"geo_enabled"`
82 | ID int `json:"id"`
83 | IDStr string `json:"id_str"`
84 | IsTranslator bool `json:"is_translator"`
85 | Lang string `json:"lang"`
86 | ListedCount int `json:"listed_count"`
87 | Location string `json:"location"`
88 | Name string `json:"name"`
89 | Notifications *string `json:"notifications"`
90 | ProfileBackgroundColor string `json:"profile_background_color"`
91 | ProfileBackgroundImageURL string `json:"profile_background_image_url"`
92 | ProfileBackgroundImageURLHTTPS string `json:"profile_background_image_url_https"`
93 | ProfileBackgroundTile bool `json:"profile_background_tile"`
94 | ProfileImageURL string `json:"profile_image_url"`
95 | ProfileImageURLHTTPS string `json:"profile_image_url_https"`
96 | ProfileLinkColor string `json:"profile_link_color"`
97 | ProfileSidebarBorderColor string `json:"profile_sidebar_border_color"`
98 | ProfileSidebarFillColor string `json:"profile_sidebar_fill_color"`
99 | ProfileTextColor string `json:"profile_text_color"`
100 | ProfileUseBackgroundImage bool `json:"profile_use_background_image"`
101 | Protected bool `json:"protected"`
102 | ScreenName string `json:"screen_name"`
103 | ShowAllInlineMedia bool `json:"show_all_inline_media"`
104 | StatusesCount int `json:"statuses_count"`
105 | TimeZone string `json:"time_zone"`
106 | URL *string `json:"url"`
107 | UtcOffset int `json:"utc_offset"`
108 | Verified bool `json:"verified"`
109 | }
110 |
111 | type StatusMetadata struct {
112 | IsoLanguageCode string `json:"iso_language_code"`
113 | ResultType string `json:"result_type"`
114 | }
115 |
116 | type Status struct {
117 | Contributors *string `json:"contributors"`
118 | Coordinates *string `json:"coordinates"`
119 | CreatedAt string `json:"created_at"`
120 | Entities Entities `json:"entities"`
121 | Favorited bool `json:"favorited"`
122 | Geo *string `json:"geo"`
123 | ID int64 `json:"id"`
124 | IDStr string `json:"id_str"`
125 | InReplyToScreenName *string `json:"in_reply_to_screen_name"`
126 | InReplyToStatusID *string `json:"in_reply_to_status_id"`
127 | InReplyToStatusIDStr *string `json:"in_reply_to_status_id_str"`
128 | InReplyToUserID *string `json:"in_reply_to_user_id"`
129 | InReplyToUserIDStr *string `json:"in_reply_to_user_id_str"`
130 | Metadata StatusMetadata `json:"metadata"`
131 | Place *string `json:"place"`
132 | RetweetCount int `json:"retweet_count"`
133 | Retweeted bool `json:"retweeted"`
134 | Source string `json:"source"`
135 | Text string `json:"text"`
136 | Truncated bool `json:"truncated"`
137 | User User `json:"user"`
138 | }
139 |
140 | //easyjson:json
141 | type LargeStruct struct {
142 | SearchMetadata SearchMetadata `json:"search_metadata"`
143 | Statuses []Status `json:"statuses"`
144 | }
145 |
--------------------------------------------------------------------------------
/json/easyjson_test.go:
--------------------------------------------------------------------------------
1 | package json
2 |
3 | import (
4 | "strconv"
5 | "testing"
6 |
7 | "github.com/mailru/easyjson"
8 | )
9 |
10 | func BenchmarkEasyjsonUnmarshal(b *testing.B) {
11 | b.Run(strconv.Itoa(len(smallStructText)), func(b *testing.B) { benchmarkEasyjsonUnmarshalSmallData(b) })
12 | b.Run(strconv.Itoa(len(largeStructText)), func(b *testing.B) { benchmarkEasyjsonUnmarshalLargeData(b) })
13 | }
14 |
15 | func benchmarkEasyjsonUnmarshalLargeData(b *testing.B) {
16 | b.SetBytes(int64(len(largeStructText)))
17 |
18 | for i := 0; i < b.N; i++ {
19 | var s LargeStruct
20 |
21 | if err := s.UnmarshalJSON(largeStructText); err != nil {
22 | b.Error(err)
23 | }
24 | }
25 | }
26 |
27 | func benchmarkEasyjsonUnmarshalSmallData(b *testing.B) {
28 | b.SetBytes(int64(len(smallStructText)))
29 |
30 | for i := 0; i < b.N; i++ {
31 | var s Entities
32 |
33 | if err := s.UnmarshalJSON(smallStructText); err != nil {
34 | b.Error(err)
35 | }
36 | }
37 | }
38 |
39 | func BenchmarkEasyjsonMarshal(b *testing.B) {
40 | b.Run(strconv.Itoa(len(smallStructText)), func(b *testing.B) { benchmarkEasyjsonMarshalSmallData(b) })
41 | b.Run(strconv.Itoa(len(largeStructText)), func(b *testing.B) { benchmarkEasyjsonMarshalLargeData(b) })
42 | }
43 |
44 | func benchmarkEasyjsonMarshalLargeData(b *testing.B) {
45 | var l int64
46 |
47 | for i := 0; i < b.N; i++ {
48 | data, err := easyjson.Marshal(&largeStructData)
49 | if err != nil {
50 | b.Error(err)
51 | }
52 | l = int64(len(data))
53 | }
54 |
55 | b.SetBytes(l)
56 | }
57 |
58 | func benchmarkEasyjsonMarshalSmallData(b *testing.B) {
59 | var l int64
60 |
61 | for i := 0; i < b.N; i++ {
62 | data, err := easyjson.Marshal(&smallStructData)
63 | if err != nil {
64 | b.Error(err)
65 | }
66 | l = int64(len(data))
67 | }
68 |
69 | b.SetBytes(l)
70 | }
71 |
--------------------------------------------------------------------------------
/json/example.json:
--------------------------------------------------------------------------------
1 | {
2 | "statuses": [
3 | {
4 | "coordinates": null,
5 | "favorited": false,
6 | "truncated": false,
7 | "created_at": "Mon Sep 24 03:35:21 +0000 2012",
8 | "id_str": "250075927172759552",
9 | "entities": {
10 | "urls": [],
11 | "hashtags": [
12 | {
13 | "text": "freebandnames",
14 | "indices": [
15 | 20,
16 | 34
17 | ]
18 | }
19 | ],
20 | "user_mentions": []
21 | },
22 | "in_reply_to_user_id_str": null,
23 | "contributors": null,
24 | "text": "Aggressive Ponytail #freebandnames",
25 | "metadata": {
26 | "iso_language_code": "en",
27 | "result_type": "recent"
28 | },
29 | "retweet_count": 0,
30 | "in_reply_to_status_id_str": null,
31 | "id": 250075927172759552,
32 | "geo": null,
33 | "retweeted": false,
34 | "in_reply_to_user_id": null,
35 | "place": null,
36 | "user": {
37 | "profile_sidebar_fill_color": "DDEEF6",
38 | "profile_sidebar_border_color": "C0DEED",
39 | "profile_background_tile": false,
40 | "name": "Sean Cummings",
41 | "profile_image_url": "http://a0.twimg.com/profile_images/2359746665/1v6zfgqo8g0d3mk7ii5s_normal.jpeg",
42 | "created_at": "Mon Apr 26 06:01:55 +0000 2010",
43 | "location": "LA, CA",
44 | "follow_request_sent": null,
45 | "profile_link_color": "0084B4",
46 | "is_translator": false,
47 | "id_str": "137238150",
48 | "entities": {
49 | "url": {
50 | "urls": [
51 | {
52 | "expanded_url": null,
53 | "url": "",
54 | "indices": [
55 | 0,
56 | 0
57 | ]
58 | }
59 | ]
60 | },
61 | "description": {
62 | "urls": []
63 | }
64 | },
65 | "default_profile": true,
66 | "contributors_enabled": false,
67 | "favourites_count": 0,
68 | "url": null,
69 | "profile_image_url_https": "https://si0.twimg.com/profile_images/2359746665/1v6zfgqo8g0d3mk7ii5s_normal.jpeg",
70 | "utc_offset": -28800,
71 | "id": 137238150,
72 | "profile_use_background_image": true,
73 | "listed_count": 2,
74 | "profile_text_color": "333333",
75 | "lang": "en",
76 | "followers_count": 70,
77 | "protected": false,
78 | "notifications": null,
79 | "profile_background_image_url_https": "https://si0.twimg.com/images/themes/theme1/bg.png",
80 | "profile_background_color": "C0DEED",
81 | "verified": false,
82 | "geo_enabled": true,
83 | "time_zone": "Pacific Time (US & Canada)",
84 | "description": "Born 330 Live 310",
85 | "default_profile_image": false,
86 | "profile_background_image_url": "http://a0.twimg.com/images/themes/theme1/bg.png",
87 | "statuses_count": 579,
88 | "friends_count": 110,
89 | "following": null,
90 | "show_all_inline_media": false,
91 | "screen_name": "sean_cummings"
92 | },
93 | "in_reply_to_screen_name": null,
94 | "source": "Twitter for Mac",
95 | "in_reply_to_status_id": null
96 | },
97 | {
98 | "coordinates": null,
99 | "favorited": false,
100 | "truncated": false,
101 | "created_at": "Fri Sep 21 23:40:54 +0000 2012",
102 | "id_str": "249292149810667520",
103 | "entities": {
104 | "urls": [],
105 | "hashtags": [
106 | {
107 | "text": "FreeBandNames",
108 | "indices": [
109 | 20,
110 | 34
111 | ]
112 | }
113 | ],
114 | "user_mentions": []
115 | },
116 | "in_reply_to_user_id_str": null,
117 | "contributors": null,
118 | "text": "Thee Namaste Nerdz. #FreeBandNames",
119 | "metadata": {
120 | "iso_language_code": "pl",
121 | "result_type": "recent"
122 | },
123 | "retweet_count": 0,
124 | "in_reply_to_status_id_str": null,
125 | "id": 249292149810667520,
126 | "geo": null,
127 | "retweeted": false,
128 | "in_reply_to_user_id": null,
129 | "place": null,
130 | "user": {
131 | "profile_sidebar_fill_color": "DDFFCC",
132 | "profile_sidebar_border_color": "BDDCAD",
133 | "profile_background_tile": true,
134 | "name": "Chaz Martenstein",
135 | "profile_image_url": "http://a0.twimg.com/profile_images/447958234/Lichtenstein_normal.jpg",
136 | "created_at": "Tue Apr 07 19:05:07 +0000 2009",
137 | "location": "Durham, NC",
138 | "follow_request_sent": null,
139 | "profile_link_color": "0084B4",
140 | "is_translator": false,
141 | "id_str": "29516238",
142 | "entities": {
143 | "url": {
144 | "urls": [
145 | {
146 | "expanded_url": null,
147 | "url": "http://bullcityrecords.com/wnng/",
148 | "indices": [
149 | 0,
150 | 32
151 | ]
152 | }
153 | ]
154 | },
155 | "description": {
156 | "urls": []
157 | }
158 | },
159 | "default_profile": false,
160 | "contributors_enabled": false,
161 | "favourites_count": 8,
162 | "url": "http://bullcityrecords.com/wnng/",
163 | "profile_image_url_https": "https://si0.twimg.com/profile_images/447958234/Lichtenstein_normal.jpg",
164 | "utc_offset": -18000,
165 | "id": 29516238,
166 | "profile_use_background_image": true,
167 | "listed_count": 118,
168 | "profile_text_color": "333333",
169 | "lang": "en",
170 | "followers_count": 2052,
171 | "protected": false,
172 | "notifications": null,
173 | "profile_background_image_url_https": "https://si0.twimg.com/profile_background_images/9423277/background_tile.bmp",
174 | "profile_background_color": "9AE4E8",
175 | "verified": false,
176 | "geo_enabled": false,
177 | "time_zone": "Eastern Time (US & Canada)",
178 | "description": "You will come to Durham, North Carolina. I will sell you some records then, here in Durham, North Carolina. Fun will happen.",
179 | "default_profile_image": false,
180 | "profile_background_image_url": "http://a0.twimg.com/profile_background_images/9423277/background_tile.bmp",
181 | "statuses_count": 7579,
182 | "friends_count": 348,
183 | "following": null,
184 | "show_all_inline_media": true,
185 | "screen_name": "bullcityrecords"
186 | },
187 | "in_reply_to_screen_name": null,
188 | "source": "web",
189 | "in_reply_to_status_id": null
190 | },
191 | {
192 | "coordinates": null,
193 | "favorited": false,
194 | "truncated": false,
195 | "created_at": "Fri Sep 21 23:30:20 +0000 2012",
196 | "id_str": "249289491129438208",
197 | "entities": {
198 | "urls": [],
199 | "hashtags": [
200 | {
201 | "text": "freebandnames",
202 | "indices": [
203 | 29,
204 | 43
205 | ]
206 | }
207 | ],
208 | "user_mentions": []
209 | },
210 | "in_reply_to_user_id_str": null,
211 | "contributors": null,
212 | "text": "Mexican Heaven, Mexican Hell #freebandnames",
213 | "metadata": {
214 | "iso_language_code": "en",
215 | "result_type": "recent"
216 | },
217 | "retweet_count": 0,
218 | "in_reply_to_status_id_str": null,
219 | "id": 249289491129438208,
220 | "geo": null,
221 | "retweeted": false,
222 | "in_reply_to_user_id": null,
223 | "place": null,
224 | "user": {
225 | "profile_sidebar_fill_color": "99CC33",
226 | "profile_sidebar_border_color": "829D5E",
227 | "profile_background_tile": false,
228 | "name": "Thomas John Wakeman",
229 | "profile_image_url": "http://a0.twimg.com/profile_images/2219333930/Froggystyle_normal.png",
230 | "created_at": "Tue Sep 01 21:21:35 +0000 2009",
231 | "location": "Kingston New York",
232 | "follow_request_sent": null,
233 | "profile_link_color": "D02B55",
234 | "is_translator": false,
235 | "id_str": "70789458",
236 | "entities": {
237 | "url": {
238 | "urls": [
239 | {
240 | "expanded_url": null,
241 | "url": "",
242 | "indices": [
243 | 0,
244 | 0
245 | ]
246 | }
247 | ]
248 | },
249 | "description": {
250 | "urls": []
251 | }
252 | },
253 | "default_profile": false,
254 | "contributors_enabled": false,
255 | "favourites_count": 19,
256 | "url": null,
257 | "profile_image_url_https": "https://si0.twimg.com/profile_images/2219333930/Froggystyle_normal.png",
258 | "utc_offset": -18000,
259 | "id": 70789458,
260 | "profile_use_background_image": true,
261 | "listed_count": 1,
262 | "profile_text_color": "3E4415",
263 | "lang": "en",
264 | "followers_count": 63,
265 | "protected": false,
266 | "notifications": null,
267 | "profile_background_image_url_https": "https://si0.twimg.com/images/themes/theme5/bg.gif",
268 | "profile_background_color": "352726",
269 | "verified": false,
270 | "geo_enabled": false,
271 | "time_zone": "Eastern Time (US & Canada)",
272 | "description": "Science Fiction Writer, sort of. Likes Superheroes, Mole People, Alt. Timelines.",
273 | "default_profile_image": false,
274 | "profile_background_image_url": "http://a0.twimg.com/images/themes/theme5/bg.gif",
275 | "statuses_count": 1048,
276 | "friends_count": 63,
277 | "following": null,
278 | "show_all_inline_media": false,
279 | "screen_name": "MonkiesFist"
280 | },
281 | "in_reply_to_screen_name": null,
282 | "source": "web",
283 | "in_reply_to_status_id": null
284 | },
285 | {
286 | "coordinates": null,
287 | "favorited": false,
288 | "truncated": false,
289 | "created_at": "Fri Sep 21 22:51:18 +0000 2012",
290 | "id_str": "249279667666817024",
291 | "entities": {
292 | "urls": [],
293 | "hashtags": [
294 | {
295 | "text": "freebandnames",
296 | "indices": [
297 | 20,
298 | 34
299 | ]
300 | }
301 | ],
302 | "user_mentions": []
303 | },
304 | "in_reply_to_user_id_str": null,
305 | "contributors": null,
306 | "text": "The Foolish Mortals #freebandnames",
307 | "metadata": {
308 | "iso_language_code": "en",
309 | "result_type": "recent"
310 | },
311 | "retweet_count": 0,
312 | "in_reply_to_status_id_str": null,
313 | "id": 249279667666817024,
314 | "geo": null,
315 | "retweeted": false,
316 | "in_reply_to_user_id": null,
317 | "place": null,
318 | "user": {
319 | "profile_sidebar_fill_color": "BFAC83",
320 | "profile_sidebar_border_color": "615A44",
321 | "profile_background_tile": true,
322 | "name": "Marty Elmer",
323 | "profile_image_url": "http://a0.twimg.com/profile_images/1629790393/shrinker_2000_trans_normal.png",
324 | "created_at": "Mon May 04 00:05:00 +0000 2009",
325 | "location": "Wisconsin, USA",
326 | "follow_request_sent": null,
327 | "profile_link_color": "3B2A26",
328 | "is_translator": false,
329 | "id_str": "37539828",
330 | "entities": {
331 | "url": {
332 | "urls": [
333 | {
334 | "expanded_url": null,
335 | "url": "http://www.omnitarian.me",
336 | "indices": [
337 | 0,
338 | 24
339 | ]
340 | }
341 | ]
342 | },
343 | "description": {
344 | "urls": []
345 | }
346 | },
347 | "default_profile": false,
348 | "contributors_enabled": false,
349 | "favourites_count": 647,
350 | "url": "http://www.omnitarian.me",
351 | "profile_image_url_https": "https://si0.twimg.com/profile_images/1629790393/shrinker_2000_trans_normal.png",
352 | "utc_offset": -21600,
353 | "id": 37539828,
354 | "profile_use_background_image": true,
355 | "listed_count": 52,
356 | "profile_text_color": "000000",
357 | "lang": "en",
358 | "followers_count": 608,
359 | "protected": false,
360 | "notifications": null,
361 | "profile_background_image_url_https": "https://si0.twimg.com/profile_background_images/106455659/rect6056-9.png",
362 | "profile_background_color": "EEE3C4",
363 | "verified": false,
364 | "geo_enabled": false,
365 | "time_zone": "Central Time (US & Canada)",
366 | "description": "Cartoonist, Illustrator, and T-Shirt connoisseur",
367 | "default_profile_image": false,
368 | "profile_background_image_url": "http://a0.twimg.com/profile_background_images/106455659/rect6056-9.png",
369 | "statuses_count": 3575,
370 | "friends_count": 249,
371 | "following": null,
372 | "show_all_inline_media": true,
373 | "screen_name": "Omnitarian"
374 | },
375 | "in_reply_to_screen_name": null,
376 | "source": "Twitter for iPhone",
377 | "in_reply_to_status_id": null
378 | }
379 | ],
380 | "search_metadata": {
381 | "max_id": 250126199840518145,
382 | "since_id": 24012619984051000,
383 | "refresh_url": "?since_id=250126199840518145&q=%23freebandnames&result_type=mixed&include_entities=1",
384 | "next_results": "?max_id=249279667666817023&q=%23freebandnames&count=4&include_entities=1&result_type=mixed",
385 | "count": 4,
386 | "completed_in": 0.035,
387 | "since_id_str": "24012619984051000",
388 | "query": "%23freebandnames",
389 | "max_id_str": "250126199840518145"
390 | }
391 | }
--------------------------------------------------------------------------------
/json/standard_test.go:
--------------------------------------------------------------------------------
1 | package json
2 |
3 | import (
4 | "encoding/json"
5 | "strconv"
6 | "testing"
7 | )
8 |
9 | func BenchmarkStdjsonUnmarshal(b *testing.B) {
10 | b.Run(strconv.Itoa(len(smallStructText)), func(b *testing.B) { benchmarkStdUnmarshalSmallData(b) })
11 | b.Run(strconv.Itoa(len(largeStructText)), func(b *testing.B) { benchmarkStdUnmarshalLargeData(b) })
12 | }
13 |
14 | func benchmarkStdUnmarshalLargeData(b *testing.B) {
15 | b.SetBytes(int64(len(largeStructText)))
16 |
17 | for i := 0; i < b.N; i++ {
18 | var s LargeStruct
19 |
20 | if err := json.Unmarshal(largeStructText, &s); err != nil {
21 | b.Error(err)
22 | }
23 | }
24 | }
25 |
26 | func benchmarkStdUnmarshalSmallData(b *testing.B) {
27 | b.SetBytes(int64(len(smallStructText)))
28 |
29 | for i := 0; i < b.N; i++ {
30 | var s Entities
31 |
32 | if err := json.Unmarshal(smallStructText, &s); err != nil {
33 | b.Error(err)
34 | }
35 | }
36 | }
37 |
38 | func BenchmarkStdjsonMarshal(b *testing.B) {
39 | b.Run(strconv.Itoa(len(smallStructText)), func(b *testing.B) { benchmarkStdMarshalSmallData(b) })
40 | b.Run(strconv.Itoa(len(largeStructText)), func(b *testing.B) { benchmarkStdMarshalLargeData(b) })
41 | }
42 |
43 | func benchmarkStdMarshalLargeData(b *testing.B) {
44 | var l int64
45 |
46 | for i := 0; i < b.N; i++ {
47 | data, err := json.Marshal(&largeStructData)
48 | if err != nil {
49 | b.Error(err)
50 | }
51 | l = int64(len(data))
52 | }
53 |
54 | b.SetBytes(l)
55 | }
56 |
57 | func benchmarkStdMarshalSmallData(b *testing.B) {
58 | var l int64
59 |
60 | for i := 0; i < b.N; i++ {
61 | data, err := json.Marshal(&smallStructData)
62 | if err != nil {
63 | b.Error(err)
64 | }
65 | l = int64(len(data))
66 | }
67 |
68 | b.SetBytes(l)
69 | }
70 |
--------------------------------------------------------------------------------
/queues/README.md:
--------------------------------------------------------------------------------
1 | # Introduction
2 | This directory includes queue implementation benchmarks for various different configurations of producer and consumer counts. Each data structure may have different safety and ordering guarantees. This document should include results along with safety and ordering information to inform the viewers of the tradeoffs.
3 |
4 | # Guarantees
5 | Different queue-like data structures sometimes make tradeoffs for performance so we can't treat all of these libraries as equals. What they do is give you a basic FIFO interface but what they guarantee in safety and ordering can differ. This section documents the guarantees each provide so you can decide what is best for you.
6 |
7 | ### Data loss
8 | Below is a description of data loss behaviours queues can experience that may be important for your use case to understand.
9 |
10 | **_D1_**. Producers outpace consumers and overwrite unread records.
11 | Often seen in ring buffer implementations if a producer hits the end of the buffer it loops back to the front and keeps writing. If the producer is outpacing the consumer it means the producer could eventually lap the consumer and overwrite records causing data loss.
12 |
13 | **_D2_**. Producers outpace consumers and consumers skip records to keep up.
14 | If the consumer isn't keeping up with the producer some implementations may skip records to keep up.
15 |
16 | ```
17 | Library Order preserving Data loss Producers Consumers
18 | --------------------------------------------------------------------------------
19 | Channels Yes No 1+ 1+
20 | Diodes Yes D1 1+ 1+
21 | Fastlane Yes No 1 1
22 | ```
23 |
24 | # Setup
25 | ```
26 | Ubuntu Linux
27 | Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz x 20 Cores (40 Hyperthreaded)
28 | L1 Cache: 320 kB
29 | L2 Cache: 2560 kB
30 | L3 Cache: 25600 kB
31 | Memory: 126 GB
32 | ```
33 |
34 | # Results
35 | [](https://github.com/kellabyte/go-benchmarks/raw/master/results/queues.png)
36 |
37 | ### p90
38 | [](https://github.com/kellabyte/go-benchmarks/raw/master/results/queues_p90.png)
39 | ### p99
40 | [](https://github.com/kellabyte/go-benchmarks/raw/master/results/queues_p99.png)
41 | ### p999
42 | [](https://github.com/kellabyte/go-benchmarks/raw/master/results/queues_p999.png)
43 | ### p9999
44 | [](https://github.com/kellabyte/go-benchmarks/raw/master/results/queues_p9999.png)
45 | ### p99999
46 | [](https://github.com/kellabyte/go-benchmarks/raw/master/results/queues_p99999.png)
47 | ### p999999
48 | [](https://github.com/kellabyte/go-benchmarks/raw/master/results/queues_p99999.png)
49 | ### p9999999
50 | [](https://github.com/kellabyte/go-benchmarks/raw/master/results/queues_p999999.png)
51 |
52 | ```
53 | make queues
54 |
55 | goos: linux
56 | goarch: amd64
57 | pkg: github.com/kellabyte/go-benchmarks/queues
58 | Benchmark1Producer1ConsumerChannel-40 5000000 223 ns/op 4.48 MB/s 0 B/op 0 allocs/op
59 | Benchmark1Producer1ConsumerDiode-40 10000000 211 ns/op 4.73 MB/s 15 B/op 0 allocs/op
60 | Benchmark1Producer1ConsumerFastlane-40 10000000 175 ns/op 5.69 MB/s 16 B/op 1 allocs/op
61 | Benchmark1Producer1ConsumerOneRing-40 20000000 106 ns/op 9.39 MB/s 0 B/op 0 allocs/op
62 | Benchmark1Producer1ConsumerOneRing2-40 20000000 83.8 ns/op 11.93 MB/s 0 B/op 0 allocs/op
63 | PASS
64 | ok github.com/kellabyte/go-benchmarks/queues 13.473s
65 | ```
--------------------------------------------------------------------------------
/queues/one_to_one/queues_test.go:
--------------------------------------------------------------------------------
1 | package queues
2 |
3 | import (
4 | "runtime"
5 | "sync"
6 | "testing"
7 | "unsafe"
8 |
9 | "code.cloudfoundry.org/go-diodes"
10 | "github.com/codahale/hdrhistogram"
11 | "github.com/loov/hrtime"
12 | "github.com/pltr/onering"
13 | "github.com/tidwall/fastlane"
14 | "github.com/tylertreat/hdrhistogram-writer"
15 | )
16 |
17 | func mknumslice(n int) []int64 {
18 | var s = make([]int64, n)
19 | for i := range s {
20 | s[i] = int64(i)
21 | }
22 | return s
23 | }
24 |
25 | func BenchmarkChannel(b *testing.B) {
26 | bench := hrtime.NewBenchmarkTSC(b.N)
27 | q := make(chan *int64, 8192)
28 | var numbers = mknumslice(b.N)
29 | var wg sync.WaitGroup
30 | wg.Add(2)
31 |
32 | go func(n int) {
33 | runtime.LockOSThread()
34 | for i := 0; i < n; i++ {
35 | q <- &numbers[i]
36 | }
37 | wg.Done()
38 | }(b.N)
39 |
40 | b.ResetTimer()
41 | go func() {
42 | runtime.LockOSThread()
43 | for bench.Next() {
44 | <-q
45 | b.SetBytes(1)
46 | }
47 | wg.Done()
48 | }()
49 |
50 | wg.Wait()
51 |
52 | b.StopTimer()
53 | recordLatencyDistributionBenchmark("channel", bench)
54 | }
55 |
56 | func BenchmarkDiode(b *testing.B) {
57 | bench := hrtime.NewBenchmarkTSC(b.N)
58 |
59 | d := diodes.NewPoller(diodes.NewOneToOne(b.N, diodes.AlertFunc(func(missed int) {
60 | panic("Oops...")
61 | })))
62 | var numbers = mknumslice(b.N)
63 | var wg sync.WaitGroup
64 | wg.Add(2)
65 |
66 | go func(n int) {
67 | for i := 0; i < n; i++ {
68 | d.Set(diodes.GenericDataType(&numbers[i]))
69 | }
70 | wg.Done()
71 | }(b.N)
72 |
73 | b.ResetTimer()
74 | go func() {
75 | for bench.Next() {
76 | d.Next()
77 | b.SetBytes(1)
78 | }
79 | wg.Done()
80 | }()
81 |
82 | wg.Wait()
83 |
84 | b.StopTimer()
85 | recordLatencyDistributionBenchmark("diode", bench)
86 | }
87 |
88 | func BenchmarkFastlane(b *testing.B) {
89 | bench := hrtime.NewBenchmarkTSC(b.N)
90 | var numbers = mknumslice(b.N)
91 | var ch fastlane.ChanPointer
92 | var wg sync.WaitGroup
93 | wg.Add(2)
94 |
95 | go func() {
96 | for bench.Next() {
97 | ch.Recv()
98 | b.SetBytes(1)
99 | }
100 | wg.Done()
101 | }()
102 |
103 | b.ResetTimer()
104 | go func(n int) {
105 | for i := 0; i < n; i++ {
106 | ch.Send(unsafe.Pointer(&numbers[i]))
107 | }
108 | wg.Done()
109 | }(b.N)
110 |
111 | wg.Wait()
112 |
113 | b.StopTimer()
114 | recordLatencyDistributionBenchmark("fastlane", bench)
115 | }
116 |
117 | func BenchmarkOneRing(b *testing.B) {
118 | bench := hrtime.NewBenchmarkTSC(b.N)
119 | var numbers = mknumslice(b.N)
120 | var ring = onering.New{Size: 8192}.SPSC()
121 | var wg sync.WaitGroup
122 | wg.Add(2)
123 |
124 | go func(n int) {
125 | runtime.LockOSThread()
126 | for i := 0; i < n; i++ {
127 | ring.Put(&numbers[i])
128 | }
129 | ring.Close()
130 | wg.Done()
131 | }(b.N)
132 |
133 | b.ResetTimer()
134 | go func(n int64) {
135 | runtime.LockOSThread()
136 | var v *int64
137 | for bench.Next() {
138 | ring.Get(&v)
139 | b.SetBytes(1)
140 | }
141 | wg.Done()
142 | }(int64(b.N))
143 |
144 | wg.Wait()
145 |
146 | b.StopTimer()
147 | recordLatencyDistributionBenchmark("onering", bench)
148 | }
149 |
150 | func recordLatencyDistributionBenchmark(name string, bench *hrtime.BenchmarkTSC) {
151 | histogram := hdrhistogram.New(1, 1000000, 5)
152 | for _, lap := range bench.Laps() {
153 | histogram.RecordValue(int64(lap))
154 | }
155 | histwriter.WriteDistributionFile(histogram, nil, 1.0, "../../results/"+name+".histogram")
156 | }
157 |
--------------------------------------------------------------------------------
/reporting/README.md:
--------------------------------------------------------------------------------
1 | # Reporting
2 | This directory contains the R scripts that generate the benchmark reports.
3 |
4 | # Generating reports
5 | You can see examples of how the reports are generated in the `Makefile` using R scripts. You can find some sample result files in `results/samples`.
6 |
7 | ```
8 | Rscript plotting/gobench_multi_nsop.r ./results/samples/hashing.log ./results/hashing-multi.png
9 | ```
10 | _Figure 1_. Example command to generate a multi-graph report using R.
11 |
12 | ```
13 | Rscript plotting/gobench_single_nsop.r ./results/samples/queues.log ./results/queues.png
14 | ```
15 | _Figure 2_. Example command to generate a single graph report using R.
16 |
17 | ```
18 | Rscript plotting/gobench_histogram_nsop.r ./results/samples/hashing.log ./results/hashing-histogram.png
19 | ```
20 | _Figure 3_. Example command to generate a histogram graph using R.
21 |
22 | ```
23 | Rscript ./plotting/hdr_histogram.r ./results/samples/nanotime.histogram ./results/hrtime.histogram 6 results/time_p999999.png
24 | ```
25 | _Figure 4_. Example command to generate a latency distribution graph using HdrHistogram log file with R.
26 |
--------------------------------------------------------------------------------
/reporting/gobench_histogram_nsop.r:
--------------------------------------------------------------------------------
1 | # Rscript gobench.r gobench.out output.png
2 |
3 | # Parse the command line args.
4 | args = commandArgs(trailingOnly=TRUE) # this line only works when you run this script from the command line.
5 |
6 | library(tidyverse)
7 | library(drlib)
8 |
9 | plot = readr::read_delim(args[1], "\t", skip = 3, col_names = FALSE) %>%
10 | set_names("Name", "Ops", "NsPerOp", "MBPerS", "AllocatedBytesPerOp", "AllocationsPerOp") %>%
11 |
12 | # Clean up the text so we get numbers
13 | mutate(NsPerOp = as.numeric(str_replace(NsPerOp, " ns/op", "")),
14 | MBPerS = as.numeric(str_replace(MBPerS, " MB/s", "")),
15 | AllocatedBytesPerOp = as.numeric(str_replace(AllocatedBytesPerOp, " B/op", "")),
16 | AllocationsPerOp = as.numeric(str_replace(AllocationsPerOp, " allocs/op", "")),
17 | Ops = as.numeric(Ops)) %>%
18 | filter(!is.na(NsPerOp)) %>%
19 |
20 | # Strip out the "Benchmark" prefix from the benchmark name.
21 | mutate (Name = str_replace(Name, "Benchmark", "")) %>%
22 |
23 | # Split out the cores.
24 | separate(Name, c("Name", "Cores"), "-") %>%
25 | mutate(Cores = as.numeric(Cores)) %>%
26 |
27 | # Split out the bytes.
28 | separate(Name, c("Name", "Bytes"), "/") %>%
29 | mutate(Bytes = as.numeric(Bytes)) %>%
30 |
31 | ggplot(aes(x=reorder(Name,NsPerOp), y=NsPerOp,
32 | group=as.factor(Bytes), fill=as.factor(Bytes))) +
33 | geom_histogram(stat="identity") +
34 | xlab("name") +
35 | ylab("nanoseconds per operation") +
36 | labs(fill='bytes') +
37 | theme(axis.text.x = element_text(angle = 45, hjust = 1),
38 | axis.title.x=element_blank()) +
39 |
40 | theme(text = element_text(size=20))
41 |
42 |
43 | ggsave(args[2], plot, width = 16, height = 9)
--------------------------------------------------------------------------------
/reporting/gobench_multi_nsop.r:
--------------------------------------------------------------------------------
1 | # Rscript gobench.r gobench.out output.png
2 |
3 | # Parse the command line args.
4 | args = commandArgs(trailingOnly=TRUE) # this line only works when you run this script from the command line.
5 |
6 | library(tidyverse)
7 | library(drlib)
8 |
9 | plot = readr::read_delim(args[1], "\t", skip = 3, col_names = FALSE) %>%
10 | set_names("Name", "Ops", "NsPerOp", "MBPerS", "AllocatedBytesPerOp", "AllocationsPerOp") %>%
11 |
12 | # Clean up the text so we get numbers
13 | mutate(NsPerOp = as.numeric(str_replace(NsPerOp, " ns/op", "")),
14 | MBPerS = as.numeric(str_replace(MBPerS, " MB/s", "")),
15 | AllocatedBytesPerOp = as.numeric(str_replace(AllocatedBytesPerOp, " B/op", "")),
16 | AllocationsPerOp = as.numeric(str_replace(AllocationsPerOp, " allocs/op", "")),
17 | Ops = as.numeric(Ops)) %>%
18 | filter(!is.na(NsPerOp)) %>%
19 |
20 | # Strip out the "Benchmark" prefix from the benchmark name.
21 | mutate (Name = str_replace(Name, "Benchmark", "")) %>%
22 |
23 | # Split out the cores.
24 | separate(Name, c("Name", "Cores"), "-") %>%
25 | mutate(Cores = as.numeric(Cores)) %>%
26 |
27 | # Split out the bytes.
28 | separate(Name, c("Name", "Bytes"), "/") %>%
29 | mutate(Bytes = as.numeric(Bytes)) %>%
30 |
31 | # Generate the plots.
32 | ggplot(aes(Name, NsPerOp)) +
33 | geom_col() +
34 | rotate_x_labels(vjust = .5) +
35 | # labs(title="Title", subtitle="Sub title") +
36 | theme(text = element_text(size=14)) +
37 | xlab("name") +
38 | ylab("nanoseconds per operation") +
39 | facet_wrap(~ Bytes, scales="free_y")
40 |
41 | ggsave(args[2], plot, width = 16, height = 9)
--------------------------------------------------------------------------------
/reporting/gobench_single_nsop.r:
--------------------------------------------------------------------------------
1 | # Rscript gobench.r gobench.out output.png
2 |
3 | # Parse the command line args.
4 | args = commandArgs(trailingOnly=TRUE) # this line only works when you run this script from the command line.
5 |
6 | library(tidyverse)
7 | library(drlib)
8 |
9 | plot = readr::read_delim(args[1], "\t", skip = 3, col_names = FALSE) %>%
10 | set_names("Name", "Ops", "NsPerOp", "MBPerS", "AllocatedBytesPerOp", "AllocationsPerOp") %>%
11 |
12 | # Clean up the text so we get numbers
13 | mutate(NsPerOp = as.numeric(str_replace(NsPerOp, " ns/op", "")),
14 | MBPerS = as.numeric(str_replace(MBPerS, " MB/s", "")),
15 | AllocatedBytesPerOp = as.numeric(str_replace(AllocatedBytesPerOp, " B/op", "")),
16 | AllocationsPerOp = as.numeric(str_replace(AllocationsPerOp, " allocs/op", "")),
17 | Ops = as.numeric(Ops)) %>%
18 | filter(!is.na(NsPerOp)) %>%
19 |
20 | # Strip out the "Benchmark" prefix from the benchmark name.
21 | mutate (Name = str_replace(Name, "Benchmark", "")) %>%
22 |
23 | # Split out the cores.
24 | separate(Name, c("Name", "Cores"), "-") %>%
25 | mutate(Cores = as.numeric(Cores)) %>%
26 |
27 | # Generate the plots.
28 | ggplot(aes(Name, NsPerOp)) +
29 | theme(text = element_text(size=24)) +
30 | geom_col() +
31 | rotate_x_labels(vjust = .5) +
32 | # labs(title="Title", subtitle="Sub title") +
33 | xlab("name") +
34 | ylab("nanoseconds per operation")
35 |
36 | ggsave(args[2], plot, width = 16, height = 9)
--------------------------------------------------------------------------------
/reporting/hdr_histogram.r:
--------------------------------------------------------------------------------
1 | #Rscript hdr_histogram.r histogramfile1 histogramfile2 ... histogramfileN NumberOfNines output.png
2 | args = commandArgs(trailingOnly=TRUE)
3 | output = args[length(args)]
4 | nines = as.numeric(args[length(args) -1])
5 | files = args[1:(length(args)-2)]
6 |
7 | library(tidyverse)
8 | library(drlib)
9 | library(stringr)
10 | library(tidyr)
11 |
12 | plot = data_frame(FileName = files) %>%
13 | mutate(lines = map(FileName, ~ data.frame(line = readr::read_lines(.x, skip = 2)))) %>%
14 | unnest(lines) %>%
15 | mutate(line = trimws(line)) %>%
16 | separate(line, c("Value", "Percentile", "TotalCount", "OneOnOneMinusPercentile"), "\\s+") %>%
17 | mutate(Value = as.numeric(Value),
18 | Percentile = as.numeric(Percentile),
19 | TotalCount = as.numeric(TotalCount),
20 | OneOnOneMinusPercentile = as.numeric(OneOnOneMinusPercentile)) %>%
21 | mutate(Nines = log10(1-Percentile) / log10(.1)) %>%
22 | filter(!is.na(OneOnOneMinusPercentile)) %>%
23 | filter(Nines <= nines + .02) %>%
24 | ggplot(aes(Nines, Value, color=FileName)) +
25 | geom_line() +
26 | scale_x_continuous(breaks = 0:(nines), labels=paste0((1-(.1^(0:(nines)))) * 100, "%"), limits = c(0, nines + .02)) +
27 | labs(x="Percentile",
28 | y="Latency",
29 | title="Latency by Percentile Distribution") +
30 | theme_minimal() +
31 | theme(legend.position = "bottom") +
32 | theme(text = element_text(size=14))
33 |
34 |
35 | ggsave(output, plot, width = 16, height = 4)
36 |
--------------------------------------------------------------------------------
/reporting/setup.r:
--------------------------------------------------------------------------------
1 | #install.packages("rmarkdown", repos = "http://cran.us.r-project.org")
2 | install.packages("ggplot2", repos = "http://cran.us.r-project.org")
3 | install.packages("tidyverse", repos = "http://cran.us.r-project.org")
4 | install.packages("devtools", repos = "http://cran.us.r-project.org")
5 | library(devtools)
6 | devtools::install_github("dgrtwo/drlib")
7 |
--------------------------------------------------------------------------------
/results/calls.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kellabyte/go-benchmarks/36847db9ae394cc7d8e6d040e977f03c597998c4/results/calls.png
--------------------------------------------------------------------------------
/results/hashing-histogram.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kellabyte/go-benchmarks/36847db9ae394cc7d8e6d040e977f03c597998c4/results/hashing-histogram.png
--------------------------------------------------------------------------------
/results/hashing-multi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kellabyte/go-benchmarks/36847db9ae394cc7d8e6d040e977f03c597998c4/results/hashing-multi.png
--------------------------------------------------------------------------------
/results/json-multi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kellabyte/go-benchmarks/36847db9ae394cc7d8e6d040e977f03c597998c4/results/json-multi.png
--------------------------------------------------------------------------------
/results/queues.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kellabyte/go-benchmarks/36847db9ae394cc7d8e6d040e977f03c597998c4/results/queues.png
--------------------------------------------------------------------------------
/results/queues_p90.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kellabyte/go-benchmarks/36847db9ae394cc7d8e6d040e977f03c597998c4/results/queues_p90.png
--------------------------------------------------------------------------------
/results/queues_p99.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kellabyte/go-benchmarks/36847db9ae394cc7d8e6d040e977f03c597998c4/results/queues_p99.png
--------------------------------------------------------------------------------
/results/queues_p999.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kellabyte/go-benchmarks/36847db9ae394cc7d8e6d040e977f03c597998c4/results/queues_p999.png
--------------------------------------------------------------------------------
/results/queues_p9999.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kellabyte/go-benchmarks/36847db9ae394cc7d8e6d040e977f03c597998c4/results/queues_p9999.png
--------------------------------------------------------------------------------
/results/queues_p99999.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kellabyte/go-benchmarks/36847db9ae394cc7d8e6d040e977f03c597998c4/results/queues_p99999.png
--------------------------------------------------------------------------------
/results/queues_p999999.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kellabyte/go-benchmarks/36847db9ae394cc7d8e6d040e977f03c597998c4/results/queues_p999999.png
--------------------------------------------------------------------------------
/results/samples/channel.histogram:
--------------------------------------------------------------------------------
1 | Value Percentile TotalCount 1/(1-Percentile)
2 |
3 | 0.000000 0.000000 0 1.000000
4 | 49.000000 0.100000 1000000 1.111111
5 | 50.000000 0.200000 2000000 1.250000
6 | 51.000000 0.300000 3000000 1.428571
7 | 52.000000 0.400000 4000000 1.666667
8 | 52.000000 0.500000 5000000 2.000000
9 | 53.000000 0.550000 5499999 2.222222
10 | 55.000000 0.600000 5999999 2.500000
11 | 56.000000 0.650000 6499999 2.857143
12 | 56.000000 0.700000 6999999 3.333333
13 | 57.000000 0.750000 7499999 4.000000
14 | 57.000000 0.775000 7749999 4.444444
15 | 58.000000 0.800000 7999999 5.000000
16 | 60.000000 0.825000 8249999 5.714286
17 | 61.000000 0.850000 8499999 6.666667
18 | 65.000000 0.875000 8749999 8.000000
19 | 74.000000 0.887500 8874999 8.888889
20 | 82.000000 0.900000 8999999 10.000000
21 | 88.000000 0.912500 9124999 11.428571
22 | 101.000000 0.925000 9249999 13.333333
23 | 127.000000 0.937500 9374999 16.000000
24 | 169.000000 0.943750 9437499 17.777778
25 | 262.000000 0.950000 9499999 20.000000
26 | 492.000000 0.956250 9562499 22.857143
27 | 797.000000 0.962500 9624999 26.666667
28 | 1280.000000 0.968750 9687499 32.000000
29 | 1482.000000 0.971875 9718749 35.555556
30 | 1649.000000 0.975000 9749999 40.000000
31 | 1771.000000 0.978125 9781249 45.714286
32 | 1907.000000 0.981250 9812499 53.333333
33 | 2151.000000 0.984375 9843749 64.000000
34 | 2334.000000 0.985938 9859379 71.113640
35 | 2557.000000 0.987500 9874999 80.000000
36 | 2785.000000 0.989062 9890619 91.424392
37 | 2996.000000 0.990625 9906249 106.666667
38 | 3236.000000 0.992188 9921879 128.008193
39 | 3394.000000 0.992969 9929689 142.227279
40 | 3605.000000 0.993750 9937499 160.000000
41 | 3880.000000 0.994531 9945309 182.848784
42 | 4155.000000 0.995313 9953129 213.356091
43 | 4421.000000 0.996094 9960939 256.016385
44 | 4559.000000 0.996484 9964839 284.414107
45 | 4713.000000 0.996875 9968749 320.000000
46 | 4884.000000 0.997266 9972659 365.764448
47 | 5068.000000 0.997656 9976559 426.621160
48 | 5258.000000 0.998047 9980469 512.032770
49 | 5359.000000 0.998242 9982419 568.828214
50 | 5471.000000 0.998437 9984369 639.795266
51 | 5590.000000 0.998633 9986329 731.528895
52 | 5718.000000 0.998828 9988279 853.242321
53 | 5876.000000 0.999023 9990229 1023.541453
54 | 5972.000000 0.999121 9991209 1137.656428
55 | 6085.000000 0.999219 9992189 1280.409731
56 | 6226.000000 0.999316 9993159 1461.988304
57 | 6412.000000 0.999414 9994139 1706.484642
58 | 6672.000000 0.999512 9995119 2049.180328
59 | 6832.000000 0.999561 9995609 2277.904328
60 | 7010.000000 0.999609 9996089 2557.544757
61 | 7259.000000 0.999658 9996579 2923.976608
62 | 7595.000000 0.999707 9997069 3412.969283
63 | 8036.000000 0.999756 9997559 4098.360656
64 | 8332.000000 0.999780 9997799 4545.454545
65 | 8765.000000 0.999805 9998049 5128.205128
66 | 9205.000000 0.999829 9998289 5847.953216
67 | 9759.000000 0.999854 9998539 6849.315068
68 | 10516.000000 0.999878 9998779 8196.721311
69 | 11107.000000 0.999890 9998899 9090.909091
70 | 11894.000000 0.999902 9999019 10204.081633
71 | 12323.000000 0.999915 9999149 11764.705882
72 | 12674.000000 0.999927 9999269 13698.630137
73 | 13111.000000 0.999939 9999389 16393.442623
74 | 13443.000000 0.999945 9999449 18181.818182
75 | 13923.000000 0.999951 9999509 20408.163265
76 | 14344.000000 0.999957 9999569 23255.813953
77 | 14824.000000 0.999963 9999629 27027.027027
78 | 15327.000000 0.999969 9999689 32258.064516
79 | 15719.000000 0.999973 9999729 37037.037037
80 | 16055.000000 0.999976 9999759 41666.666667
81 | 16432.000000 0.999979 9999789 47619.047619
82 | 16951.000000 0.999982 9999819 55555.555555
83 | 17443.000000 0.999985 9999849 66666.666667
84 | 17696.000000 0.999986 9999859 71428.571428
85 | 18175.000000 0.999988 9999879 83333.333333
86 | 18527.000000 0.999989 9999889 90909.090909
87 | 19307.000000 0.999991 9999909 111111.111111
88 | 19722.000000 0.999992 9999919 125000.000000
89 | 20450.000000 0.999993 9999929 142857.142858
90 | 21444.000000 0.999994 9999939 166666.666665
91 | 23803.000000 0.999995 9999949 199999.999999
92 | 27444.000000 0.999996 9999959 250000.000000
93 | 32873.000000 0.999997 9999969 333333.333336
94 | 44920.000000 0.999998 9999979 499999.999986
95 | 71858.000000 0.999999 9999989 999999.999971
96 | 135941.000000 1.000000 9999999 10000000.000000
97 |
--------------------------------------------------------------------------------
/results/samples/diode.histogram:
--------------------------------------------------------------------------------
1 | Value Percentile TotalCount 1/(1-Percentile)
2 |
3 | 0.000000 0.000000 0 1.000000
4 | 48.000000 0.100000 999999 1.111111
5 | 49.000000 0.200000 1999997 1.250000
6 | 50.000000 0.300000 2999996 1.428571
7 | 52.000000 0.400000 3999994 1.666667
8 | 88.000000 0.500000 4999993 2.000000
9 | 126.000000 0.550000 5499992 2.222222
10 | 143.000000 0.600000 5999991 2.500000
11 | 161.000000 0.650000 6499990 2.857143
12 | 178.000000 0.700000 6999990 3.333333
13 | 197.000000 0.750000 7499989 4.000000
14 | 222.000000 0.775000 7749988 4.444444
15 | 249.000000 0.800000 7999988 5.000000
16 | 261.000000 0.825000 8249988 5.714286
17 | 271.000000 0.850000 8499987 6.666667
18 | 274.000000 0.875000 8749987 8.000000
19 | 276.000000 0.887500 8874987 8.888889
20 | 280.000000 0.900000 8999987 10.000000
21 | 285.000000 0.912500 9124986 11.428571
22 | 292.000000 0.925000 9249986 13.333333
23 | 349.000000 0.937500 9374986 16.000000
24 | 382.000000 0.943750 9437486 17.777778
25 | 389.000000 0.950000 9499986 20.000000
26 | 410.000000 0.956250 9562486 22.857143
27 | 445.000000 0.962500 9624986 26.666667
28 | 467.000000 0.968750 9687485 32.000000
29 | 479.000000 0.971875 9718735 35.555556
30 | 499.000000 0.975000 9749985 40.000000
31 | 510.000000 0.978125 9781235 45.714286
32 | 521.000000 0.981250 9812485 53.333333
33 | 533.000000 0.984375 9843735 64.000000
34 | 537.000000 0.985938 9859365 71.113640
35 | 542.000000 0.987500 9874985 80.000000
36 | 552.000000 0.989062 9890605 91.424392
37 | 560.000000 0.990625 9906235 106.666667
38 | 589.000000 0.992188 9921865 128.008193
39 | 605.000000 0.992969 9929675 142.227279
40 | 634.000000 0.993750 9937485 160.000000
41 | 656.000000 0.994531 9945295 182.848784
42 | 693.000000 0.995313 9953115 213.356091
43 | 717.000000 0.996094 9960925 256.016385
44 | 732.000000 0.996484 9964825 284.414107
45 | 760.000000 0.996875 9968735 320.000000
46 | 778.000000 0.997266 9972645 365.764448
47 | 789.000000 0.997656 9976545 426.621160
48 | 805.000000 0.998047 9980455 512.032770
49 | 825.000000 0.998242 9982405 568.828214
50 | 869.000000 0.998437 9984355 639.795266
51 | 903.000000 0.998633 9986315 731.528895
52 | 978.000000 0.998828 9988265 853.242321
53 | 1420.000000 0.999023 9990215 1023.541453
54 | 1481.000000 0.999121 9991195 1137.656428
55 | 1515.000000 0.999219 9992175 1280.409731
56 | 1536.000000 0.999316 9993145 1461.988304
57 | 1550.000000 0.999414 9994125 1706.484642
58 | 1570.000000 0.999512 9995105 2049.180328
59 | 1588.000000 0.999561 9995595 2277.904328
60 | 1610.000000 0.999609 9996075 2557.544757
61 | 1633.000000 0.999658 9996565 2923.976608
62 | 1659.000000 0.999707 9997055 3412.969283
63 | 1702.000000 0.999756 9997545 4098.360656
64 | 1731.000000 0.999780 9997785 4545.454545
65 | 1782.000000 0.999805 9998035 5128.205128
66 | 1865.000000 0.999829 9998275 5847.953216
67 | 2030.000000 0.999854 9998525 6849.315068
68 | 2353.000000 0.999878 9998765 8196.721311
69 | 2617.000000 0.999890 9998885 9090.909091
70 | 2837.000000 0.999902 9999005 10204.081633
71 | 3073.000000 0.999915 9999135 11764.705882
72 | 3344.000000 0.999927 9999255 13698.630137
73 | 4047.000000 0.999939 9999375 16393.442623
74 | 4707.000000 0.999945 9999435 18181.818182
75 | 5584.000000 0.999951 9999495 20408.163265
76 | 6524.000000 0.999957 9999555 23255.813953
77 | 7904.000000 0.999963 9999615 27027.027027
78 | 8851.000000 0.999969 9999675 32258.064516
79 | 9657.000000 0.999973 9999715 37037.037037
80 | 11951.000000 0.999976 9999745 41666.666667
81 | 12310.000000 0.999979 9999775 47619.047619
82 | 12543.000000 0.999982 9999805 55555.555555
83 | 12668.000000 0.999985 9999835 66666.666667
84 | 12741.000000 0.999986 9999845 71428.571428
85 | 12831.000000 0.999988 9999865 83333.333333
86 | 12898.000000 0.999989 9999875 90909.090909
87 | 13003.000000 0.999991 9999895 111111.111111
88 | 13043.000000 0.999992 9999905 125000.000000
89 | 13101.000000 0.999993 9999915 142857.142858
90 | 13142.000000 0.999994 9999925 166666.666665
91 | 13229.000000 0.999995 9999935 199999.999999
92 | 13465.000000 0.999996 9999945 250000.000000
93 | 13567.000000 0.999997 9999955 333333.333336
94 | 14287.000000 0.999998 9999965 499999.999986
95 | 22240.000000 0.999999 9999975 999999.999971
96 | 176697.000000 1.000000 9999985 10000000.000000
97 |
--------------------------------------------------------------------------------
/results/samples/fastlane.histogram:
--------------------------------------------------------------------------------
1 | Value Percentile TotalCount 1/(1-Percentile)
2 |
3 | 0.000000 0.000000 0 1.000000
4 | 28.000000 0.100000 1999999 1.111111
5 | 28.000000 0.200000 3999998 1.250000
6 | 29.000000 0.300000 5999997 1.428571
7 | 30.000000 0.400000 7999996 1.666667
8 | 41.000000 0.500000 9999996 2.000000
9 | 54.000000 0.550000 10999995 2.222222
10 | 57.000000 0.600000 11999995 2.500000
11 | 60.000000 0.650000 12999994 2.857143
12 | 63.000000 0.700000 13999994 3.333333
13 | 74.000000 0.750000 14999993 4.000000
14 | 116.000000 0.775000 15499993 4.444444
15 | 140.000000 0.800000 15999993 5.000000
16 | 165.000000 0.825000 16499993 5.714286
17 | 184.000000 0.850000 16999992 6.666667
18 | 212.000000 0.875000 17499992 8.000000
19 | 226.000000 0.887500 17749992 8.888889
20 | 235.000000 0.900000 17999992 10.000000
21 | 243.000000 0.912500 18249992 11.428571
22 | 250.000000 0.925000 18499992 13.333333
23 | 254.000000 0.937500 18749992 16.000000
24 | 256.000000 0.943750 18874992 17.777778
25 | 257.000000 0.950000 18999991 20.000000
26 | 259.000000 0.956250 19124991 22.857143
27 | 262.000000 0.962500 19249991 26.666667
28 | 265.000000 0.968750 19374991 32.000000
29 | 268.000000 0.971875 19437491 35.555556
30 | 271.000000 0.975000 19499991 40.000000
31 | 275.000000 0.978125 19562491 45.714286
32 | 280.000000 0.981250 19624991 53.333333
33 | 285.000000 0.984375 19687491 64.000000
34 | 290.000000 0.985938 19718751 71.113640
35 | 295.000000 0.987500 19749991 80.000000
36 | 302.000000 0.989062 19781231 91.424392
37 | 313.000000 0.990625 19812491 106.666667
38 | 336.000000 0.992188 19843751 128.008193
39 | 360.000000 0.992969 19859371 142.227279
40 | 383.000000 0.993750 19874991 160.000000
41 | 423.000000 0.994531 19890611 182.848784
42 | 441.000000 0.995313 19906251 213.356091
43 | 482.000000 0.996094 19921871 256.016385
44 | 488.000000 0.996484 19929671 284.414107
45 | 496.000000 0.996875 19937491 320.000000
46 | 505.000000 0.997266 19945311 365.764448
47 | 509.000000 0.997656 19953111 426.621160
48 | 519.000000 0.998047 19960931 512.032770
49 | 529.000000 0.998242 19964831 568.828214
50 | 540.000000 0.998437 19968731 639.795266
51 | 572.000000 0.998633 19972651 731.528895
52 | 671.000000 0.998828 19976551 853.242321
53 | 685.000000 0.999023 19980451 1023.541453
54 | 696.000000 0.999121 19982411 1137.656428
55 | 709.000000 0.999219 19984371 1280.409731
56 | 730.000000 0.999316 19986311 1461.988304
57 | 770.000000 0.999414 19988271 1706.484642
58 | 838.000000 0.999512 19990231 2049.180328
59 | 893.000000 0.999561 19991211 2277.904328
60 | 954.000000 0.999609 19992171 2557.544757
61 | 1042.000000 0.999658 19993151 2923.976608
62 | 1256.000000 0.999707 19994131 3412.969283
63 | 1540.000000 0.999756 19995111 4098.360656
64 | 1837.000000 0.999780 19995591 4545.454545
65 | 3368.000000 0.999805 19996091 5128.205128
66 | 5366.000000 0.999829 19996571 5847.953216
67 | 5537.000000 0.999854 19997071 6849.315068
68 | 5564.000000 0.999878 19997551 8196.721311
69 | 5578.000000 0.999890 19997791 9090.909091
70 | 5588.000000 0.999902 19998031 10204.081633
71 | 5603.000000 0.999915 19998291 11764.705882
72 | 5690.000000 0.999927 19998531 13698.630137
73 | 5861.000000 0.999939 19998771 16393.442623
74 | 6102.000000 0.999945 19998891 18181.818182
75 | 6470.000000 0.999951 19999011 20408.163265
76 | 7563.000000 0.999957 19999131 23255.813953
77 | 9929.000000 0.999963 19999251 27027.027027
78 | 12046.000000 0.999969 19999371 32258.064516
79 | 12313.000000 0.999973 19999451 37037.037037
80 | 12489.000000 0.999976 19999511 41666.666667
81 | 12676.000000 0.999979 19999571 47619.047619
82 | 12951.000000 0.999982 19999631 55555.555555
83 | 16115.000000 0.999985 19999691 66666.666667
84 | 18362.000000 0.999986 19999711 71428.571428
85 | 25168.000000 0.999988 19999751 83333.333333
86 | 28146.000000 0.999989 19999771 90909.090909
87 | 34156.000000 0.999991 19999811 111111.111111
88 | 37227.000000 0.999992 19999831 125000.000000
89 | 41154.000000 0.999993 19999851 142857.142858
90 | 45843.000000 0.999994 19999871 166666.666665
91 | 60808.000000 0.999995 19999891 199999.999999
92 | 78339.000000 0.999996 19999911 250000.000000
93 | 80426.000000 0.999997 19999931 333333.333336
94 | 83156.000000 0.999998 19999951 499999.999986
95 | 88415.000000 0.999999 19999971 999999.999971
96 | 918279.000000 1.000000 19999991 10000000.000000
97 |
--------------------------------------------------------------------------------
/results/samples/hashing.log:
--------------------------------------------------------------------------------
1 | goos: linux
2 | goarch: amd64
3 | pkg: github.com/kellabyte/go-benchmarks/hashing
4 | BenchmarkBlake2B/1-40 3000000 434 ns/op 2.30 MB/s 0 B/op 0 allocs/op
5 | BenchmarkBlake2B/2-40 3000000 405 ns/op 4.94 MB/s 0 B/op 0 allocs/op
6 | BenchmarkBlake2B/4-40 3000000 391 ns/op 10.21 MB/s 0 B/op 0 allocs/op
7 | BenchmarkBlake2B/8-40 3000000 386 ns/op 20.72 MB/s 0 B/op 0 allocs/op
8 | BenchmarkBlake2B/32-40 3000000 389 ns/op 82.24 MB/s 0 B/op 0 allocs/op
9 | BenchmarkBlake2B/64-40 5000000 349 ns/op 182.94 MB/s 0 B/op 0 allocs/op
10 | BenchmarkBlake2B/128-40 5000000 309 ns/op 412.95 MB/s 0 B/op 0 allocs/op
11 | BenchmarkBlake2B/256-40 2000000 551 ns/op 463.99 MB/s 0 B/op 0 allocs/op
12 | BenchmarkBlake2B/512-40 2000000 1021 ns/op 501.32 MB/s 0 B/op 0 allocs/op
13 | BenchmarkBlake2B/1024-40 1000000 1666 ns/op 614.59 MB/s 0 B/op 0 allocs/op
14 | BenchmarkBlake2B/4096-40 200000 6092 ns/op 672.26 MB/s 0 B/op 0 allocs/op
15 | BenchmarkBlake2B/8192-40 100000 12200 ns/op 671.44 MB/s 0 B/op 0 allocs/op
16 | BenchmarkCRC32/1-40 100000000 17.3 ns/op 57.88 MB/s 0 B/op 0 allocs/op
17 | BenchmarkCRC32/2-40 100000000 16.7 ns/op 119.82 MB/s 0 B/op 0 allocs/op
18 | BenchmarkCRC32/4-40 100000000 17.7 ns/op 226.48 MB/s 0 B/op 0 allocs/op
19 | BenchmarkCRC32/8-40 100000000 19.4 ns/op 412.04 MB/s 0 B/op 0 allocs/op
20 | BenchmarkCRC32/32-40 50000000 22.9 ns/op 1397.94 MB/s 0 B/op 0 allocs/op
21 | BenchmarkCRC32/64-40 50000000 26.1 ns/op 2449.85 MB/s 0 B/op 0 allocs/op
22 | BenchmarkCRC32/128-40 50000000 33.8 ns/op 3789.52 MB/s 0 B/op 0 allocs/op
23 | BenchmarkCRC32/256-40 30000000 49.9 ns/op 5127.67 MB/s 0 B/op 0 allocs/op
24 | BenchmarkCRC32/512-40 20000000 53.7 ns/op 9539.42 MB/s 0 B/op 0 allocs/op
25 | BenchmarkCRC32/1024-40 20000000 83.9 ns/op 12197.92 MB/s 0 B/op 0 allocs/op
26 | BenchmarkCRC32/4096-40 10000000 204 ns/op 19982.89 MB/s 0 B/op 0 allocs/op
27 | BenchmarkCRC32/8192-40 3000000 396 ns/op 20671.53 MB/s 0 B/op 0 allocs/op
28 | BenchmarkSpooky/1-40 50000000 26.3 ns/op 38.07 MB/s 0 B/op 0 allocs/op
29 | BenchmarkSpooky/2-40 50000000 26.2 ns/op 76.35 MB/s 0 B/op 0 allocs/op
30 | BenchmarkSpooky/4-40 50000000 26.5 ns/op 150.74 MB/s 0 B/op 0 allocs/op
31 | BenchmarkSpooky/8-40 50000000 27.5 ns/op 290.85 MB/s 0 B/op 0 allocs/op
32 | BenchmarkSpooky/32-40 30000000 42.7 ns/op 748.83 MB/s 0 B/op 0 allocs/op
33 | BenchmarkSpooky/64-40 30000000 53.1 ns/op 1205.27 MB/s 0 B/op 0 allocs/op
34 | BenchmarkSpooky/128-40 20000000 80.8 ns/op 1584.94 MB/s 0 B/op 0 allocs/op
35 | BenchmarkSpooky/256-40 10000000 148 ns/op 1720.33 MB/s 0 B/op 0 allocs/op
36 | BenchmarkSpooky/512-40 5000000 221 ns/op 2307.33 MB/s 0 B/op 0 allocs/op
37 | BenchmarkSpooky/1024-40 5000000 341 ns/op 2995.49 MB/s 0 B/op 0 allocs/op
38 | BenchmarkSpooky/4096-40 1000000 1154 ns/op 3546.77 MB/s 0 B/op 0 allocs/op
39 | BenchmarkSpooky/8192-40 500000 2374 ns/op 3449.36 MB/s 0 B/op 0 allocs/op
40 | BenchmarkSipHash/1-40 100000000 19.1 ns/op 52.34 MB/s 0 B/op 0 allocs/op
41 | BenchmarkSipHash/2-40 100000000 19.6 ns/op 102.19 MB/s 0 B/op 0 allocs/op
42 | BenchmarkSipHash/4-40 100000000 19.5 ns/op 205.10 MB/s 0 B/op 0 allocs/op
43 | BenchmarkSipHash/8-40 100000000 23.0 ns/op 347.64 MB/s 0 B/op 0 allocs/op
44 | BenchmarkSipHash/32-40 50000000 35.6 ns/op 898.34 MB/s 0 B/op 0 allocs/op
45 | BenchmarkSipHash/64-40 30000000 54.8 ns/op 1167.03 MB/s 0 B/op 0 allocs/op
46 | BenchmarkSipHash/128-40 20000000 90.3 ns/op 1417.75 MB/s 0 B/op 0 allocs/op
47 | BenchmarkSipHash/256-40 10000000 162 ns/op 1574.04 MB/s 0 B/op 0 allocs/op
48 | BenchmarkSipHash/512-40 5000000 296 ns/op 1729.47 MB/s 0 B/op 0 allocs/op
49 | BenchmarkSipHash/1024-40 2000000 585 ns/op 1747.52 MB/s 0 B/op 0 allocs/op
50 | BenchmarkSipHash/4096-40 1000000 2262 ns/op 1810.53 MB/s 0 B/op 0 allocs/op
51 | BenchmarkSipHash/8192-40 300000 4658 ns/op 1758.34 MB/s 0 B/op 0 allocs/op
52 | BenchmarkFarm/1-40 100000000 14.9 ns/op 66.96 MB/s 0 B/op 0 allocs/op
53 | BenchmarkFarm/2-40 100000000 14.2 ns/op 141.33 MB/s 0 B/op 0 allocs/op
54 | BenchmarkFarm/4-40 100000000 15.0 ns/op 266.69 MB/s 0 B/op 0 allocs/op
55 | BenchmarkFarm/8-40 100000000 17.7 ns/op 451.63 MB/s 0 B/op 0 allocs/op
56 | BenchmarkFarm/32-40 50000000 21.8 ns/op 1465.84 MB/s 0 B/op 0 allocs/op
57 | BenchmarkFarm/64-40 50000000 33.7 ns/op 1901.50 MB/s 0 B/op 0 allocs/op
58 | BenchmarkFarm/128-40 20000000 62.9 ns/op 2035.33 MB/s 0 B/op 0 allocs/op
59 | BenchmarkFarm/256-40 20000000 78.9 ns/op 3242.85 MB/s 0 B/op 0 allocs/op
60 | BenchmarkFarm/512-40 20000000 111 ns/op 4611.08 MB/s 0 B/op 0 allocs/op
61 | BenchmarkFarm/1024-40 10000000 172 ns/op 5929.48 MB/s 0 B/op 0 allocs/op
62 | BenchmarkFarm/4096-40 2000000 549 ns/op 7459.02 MB/s 0 B/op 0 allocs/op
63 | BenchmarkFarm/8192-40 1000000 1135 ns/op 7212.58 MB/s 0 B/op 0 allocs/op
64 | BenchmarkCity/1-40 100000000 13.4 ns/op 74.69 MB/s 0 B/op 0 allocs/op
65 | BenchmarkCity/2-40 100000000 12.1 ns/op 165.51 MB/s 0 B/op 0 allocs/op
66 | BenchmarkCity/4-40 100000000 13.1 ns/op 305.80 MB/s 0 B/op 0 allocs/op
67 | BenchmarkCity/8-40 100000000 14.4 ns/op 556.28 MB/s 0 B/op 0 allocs/op
68 | BenchmarkCity/32-40 100000000 15.5 ns/op 2065.89 MB/s 0 B/op 0 allocs/op
69 | BenchmarkCity/64-40 50000000 34.4 ns/op 1860.32 MB/s 0 B/op 0 allocs/op
70 | BenchmarkCity/128-40 10000000 143 ns/op 890.79 MB/s 0 B/op 0 allocs/op
71 | BenchmarkCity/256-40 10000000 216 ns/op 1184.51 MB/s 0 B/op 0 allocs/op
72 | BenchmarkCity/512-40 3000000 366 ns/op 1397.28 MB/s 0 B/op 0 allocs/op
73 | BenchmarkCity/1024-40 2000000 681 ns/op 1502.01 MB/s 0 B/op 0 allocs/op
74 | BenchmarkCity/4096-40 500000 2491 ns/op 1644.19 MB/s 0 B/op 0 allocs/op
75 | BenchmarkCity/8192-40 300000 4968 ns/op 1648.95 MB/s 0 B/op 0 allocs/op
76 | BenchmarkMetro/1-40 200000000 10.1 ns/op 99.29 MB/s 0 B/op 0 allocs/op
77 | BenchmarkMetro/2-40 100000000 11.3 ns/op 176.92 MB/s 0 B/op 0 allocs/op
78 | BenchmarkMetro/4-40 100000000 10.0 ns/op 399.03 MB/s 0 B/op 0 allocs/op
79 | BenchmarkMetro/8-40 100000000 10.7 ns/op 747.54 MB/s 0 B/op 0 allocs/op
80 | BenchmarkMetro/32-40 100000000 16.2 ns/op 1977.74 MB/s 0 B/op 0 allocs/op
81 | BenchmarkMetro/64-40 100000000 20.0 ns/op 3205.54 MB/s 0 B/op 0 allocs/op
82 | BenchmarkMetro/128-40 50000000 27.2 ns/op 4700.50 MB/s 0 B/op 0 allocs/op
83 | BenchmarkMetro/256-40 30000000 42.0 ns/op 6096.85 MB/s 0 B/op 0 allocs/op
84 | BenchmarkMetro/512-40 20000000 64.7 ns/op 7913.87 MB/s 0 B/op 0 allocs/op
85 | BenchmarkMetro/1024-40 10000000 113 ns/op 9051.16 MB/s 0 B/op 0 allocs/op
86 | BenchmarkMetro/4096-40 3000000 393 ns/op 10400.32 MB/s 0 B/op 0 allocs/op
87 | BenchmarkMetro/8192-40 2000000 740 ns/op 11058.86 MB/s 0 B/op 0 allocs/op
88 | BenchmarkXXHash/1-40 100000000 17.4 ns/op 57.52 MB/s 0 B/op 0 allocs/op
89 | BenchmarkXXHash/2-40 100000000 18.1 ns/op 110.65 MB/s 0 B/op 0 allocs/op
90 | BenchmarkXXHash/4-40 100000000 16.5 ns/op 242.91 MB/s 0 B/op 0 allocs/op
91 | BenchmarkXXHash/8-40 100000000 17.1 ns/op 469.11 MB/s 0 B/op 0 allocs/op
92 | BenchmarkXXHash/32-40 50000000 25.8 ns/op 1241.62 MB/s 0 B/op 0 allocs/op
93 | BenchmarkXXHash/64-40 50000000 29.3 ns/op 2185.78 MB/s 0 B/op 0 allocs/op
94 | BenchmarkXXHash/128-40 50000000 34.9 ns/op 3670.76 MB/s 0 B/op 0 allocs/op
95 | BenchmarkXXHash/256-40 30000000 45.8 ns/op 5589.47 MB/s 0 B/op 0 allocs/op
96 | BenchmarkXXHash/512-40 20000000 69.1 ns/op 7405.21 MB/s 0 B/op 0 allocs/op
97 | BenchmarkXXHash/1024-40 10000000 127 ns/op 8044.68 MB/s 0 B/op 0 allocs/op
98 | BenchmarkXXHash/4096-40 3000000 385 ns/op 10614.83 MB/s 0 B/op 0 allocs/op
99 | BenchmarkXXHash/8192-40 2000000 699 ns/op 11704.24 MB/s 0 B/op 0 allocs/op
100 | BenchmarkXXFast/1-40 200000000 8.95 ns/op 111.70 MB/s 0 B/op 0 allocs/op
101 | BenchmarkXXFast/2-40 100000000 10.5 ns/op 191.12 MB/s 0 B/op 0 allocs/op
102 | BenchmarkXXFast/4-40 200000000 9.12 ns/op 438.81 MB/s 0 B/op 0 allocs/op
103 | BenchmarkXXFast/8-40 100000000 10.7 ns/op 748.54 MB/s 0 B/op 0 allocs/op
104 | BenchmarkXXFast/32-40 100000000 17.0 ns/op 1884.95 MB/s 0 B/op 0 allocs/op
105 | BenchmarkXXFast/64-40 100000000 20.3 ns/op 3146.18 MB/s 0 B/op 0 allocs/op
106 | BenchmarkXXFast/128-40 50000000 27.7 ns/op 4617.65 MB/s 0 B/op 0 allocs/op
107 | BenchmarkXXFast/256-40 30000000 41.1 ns/op 6232.56 MB/s 0 B/op 0 allocs/op
108 | BenchmarkXXFast/512-40 20000000 62.0 ns/op 8256.58 MB/s 0 B/op 0 allocs/op
109 | BenchmarkXXFast/1024-40 10000000 109 ns/op 9335.85 MB/s 0 B/op 0 allocs/op
110 | BenchmarkXXFast/4096-40 5000000 359 ns/op 11407.57 MB/s 0 B/op 0 allocs/op
111 | BenchmarkXXFast/8192-40 2000000 691 ns/op 11840.50 MB/s 0 B/op 0 allocs/op
112 | BenchmarkFasthash/1-40 200000000 8.42 ns/op 118.71 MB/s 0 B/op 0 allocs/op
113 | BenchmarkFasthash/2-40 200000000 8.73 ns/op 229.12 MB/s 0 B/op 0 allocs/op
114 | BenchmarkFasthash/4-40 100000000 11.0 ns/op 364.81 MB/s 0 B/op 0 allocs/op
115 | BenchmarkFasthash/8-40 200000000 8.14 ns/op 982.89 MB/s 0 B/op 0 allocs/op
116 | BenchmarkFasthash/32-40 100000000 12.1 ns/op 2654.25 MB/s 0 B/op 0 allocs/op
117 | BenchmarkFasthash/64-40 100000000 17.4 ns/op 3678.63 MB/s 0 B/op 0 allocs/op
118 | BenchmarkFasthash/128-40 50000000 28.6 ns/op 4477.06 MB/s 0 B/op 0 allocs/op
119 | BenchmarkFasthash/256-40 30000000 49.7 ns/op 5149.15 MB/s 0 B/op 0 allocs/op
120 | BenchmarkFasthash/512-40 20000000 95.4 ns/op 5364.83 MB/s 0 B/op 0 allocs/op
121 | BenchmarkFasthash/1024-40 10000000 185 ns/op 5525.38 MB/s 0 B/op 0 allocs/op
122 | BenchmarkFasthash/4096-40 2000000 675 ns/op 6061.28 MB/s 0 B/op 0 allocs/op
123 | BenchmarkFasthash/8192-40 1000000 1372 ns/op 5969.82 MB/s 0 B/op 0 allocs/op
124 | BenchmarkHighway/1-40 30000000 43.0 ns/op 23.24 MB/s 0 B/op 0 allocs/op
125 | BenchmarkHighway/2-40 30000000 44.2 ns/op 45.30 MB/s 0 B/op 0 allocs/op
126 | BenchmarkHighway/4-40 30000000 44.7 ns/op 89.42 MB/s 0 B/op 0 allocs/op
127 | BenchmarkHighway/8-40 30000000 41.7 ns/op 191.90 MB/s 0 B/op 0 allocs/op
128 | BenchmarkHighway/32-40 50000000 38.1 ns/op 839.05 MB/s 0 B/op 0 allocs/op
129 | BenchmarkHighway/64-40 30000000 43.5 ns/op 1470.42 MB/s 0 B/op 0 allocs/op
130 | BenchmarkHighway/128-40 30000000 54.1 ns/op 2365.80 MB/s 0 B/op 0 allocs/op
131 | BenchmarkHighway/256-40 20000000 72.5 ns/op 3533.23 MB/s 0 B/op 0 allocs/op
132 | BenchmarkHighway/512-40 20000000 106 ns/op 4827.95 MB/s 0 B/op 0 allocs/op
133 | BenchmarkHighway/1024-40 10000000 187 ns/op 5459.66 MB/s 0 B/op 0 allocs/op
134 | BenchmarkHighway/4096-40 2000000 617 ns/op 6628.61 MB/s 0 B/op 0 allocs/op
135 | BenchmarkHighway/8192-40 1000000 1255 ns/op 6527.44 MB/s 0 B/op 0 allocs/op
136 | BenchmarkMinioHighway/1-40 20000000 80.6 ns/op 12.41 MB/s 0 B/op 0 allocs/op
137 | BenchmarkMinioHighway/2-40 20000000 79.4 ns/op 25.20 MB/s 0 B/op 0 allocs/op
138 | BenchmarkMinioHighway/4-40 20000000 79.8 ns/op 50.13 MB/s 0 B/op 0 allocs/op
139 | BenchmarkMinioHighway/8-40 20000000 77.8 ns/op 102.80 MB/s 0 B/op 0 allocs/op
140 | BenchmarkMinioHighway/32-40 30000000 54.3 ns/op 589.09 MB/s 0 B/op 0 allocs/op
141 | BenchmarkMinioHighway/64-40 20000000 58.8 ns/op 1087.72 MB/s 0 B/op 0 allocs/op
142 | BenchmarkMinioHighway/128-40 20000000 81.2 ns/op 1575.59 MB/s 0 B/op 0 allocs/op
143 | BenchmarkMinioHighway/256-40 20000000 81.5 ns/op 3142.37 MB/s 0 B/op 0 allocs/op
144 | BenchmarkMinioHighway/512-40 20000000 107 ns/op 4771.52 MB/s 0 B/op 0 allocs/op
145 | BenchmarkMinioHighway/1024-40 10000000 179 ns/op 5719.93 MB/s 0 B/op 0 allocs/op
146 | BenchmarkMinioHighway/4096-40 3000000 517 ns/op 7915.24 MB/s 0 B/op 0 allocs/op
147 | BenchmarkMinioHighway/8192-40 1000000 1036 ns/op 7905.59 MB/s 0 B/op 0 allocs/op
148 | BenchmarkMarvin32/1-40 200000000 8.80 ns/op 113.66 MB/s 0 B/op 0 allocs/op
149 | BenchmarkMarvin32/2-40 200000000 9.25 ns/op 216.13 MB/s 0 B/op 0 allocs/op
150 | BenchmarkMarvin32/4-40 100000000 10.9 ns/op 366.78 MB/s 0 B/op 0 allocs/op
151 | BenchmarkMarvin32/8-40 100000000 12.3 ns/op 651.55 MB/s 0 B/op 0 allocs/op
152 | BenchmarkMarvin32/32-40 50000000 24.1 ns/op 1327.72 MB/s 0 B/op 0 allocs/op
153 | BenchmarkMarvin32/64-40 30000000 41.8 ns/op 1530.24 MB/s 0 B/op 0 allocs/op
154 | BenchmarkMarvin32/128-40 20000000 69.6 ns/op 1839.68 MB/s 0 B/op 0 allocs/op
155 | BenchmarkMarvin32/256-40 10000000 133 ns/op 1922.30 MB/s 0 B/op 0 allocs/op
156 | BenchmarkMarvin32/512-40 5000000 265 ns/op 1929.22 MB/s 0 B/op 0 allocs/op
157 | BenchmarkMarvin32/1024-40 3000000 508 ns/op 2012.49 MB/s 0 B/op 0 allocs/op
158 | BenchmarkMarvin32/4096-40 1000000 1974 ns/op 2074.66 MB/s 0 B/op 0 allocs/op
159 | BenchmarkMarvin32/8192-40 300000 4018 ns/op 2038.66 MB/s 0 B/op 0 allocs/op
160 | BenchmarkSip13Hash/1-40 100000000 15.1 ns/op 66.31 MB/s 0 B/op 0 allocs/op
161 | BenchmarkSip13Hash/2-40 100000000 16.4 ns/op 121.66 MB/s 0 B/op 0 allocs/op
162 | BenchmarkSip13Hash/4-40 100000000 18.9 ns/op 211.78 MB/s 0 B/op 0 allocs/op
163 | BenchmarkSip13Hash/8-40 100000000 17.7 ns/op 452.56 MB/s 0 B/op 0 allocs/op
164 | BenchmarkSip13Hash/32-40 50000000 24.8 ns/op 1288.46 MB/s 0 B/op 0 allocs/op
165 | BenchmarkSip13Hash/64-40 50000000 34.1 ns/op 1879.30 MB/s 0 B/op 0 allocs/op
166 | BenchmarkSip13Hash/128-40 30000000 53.3 ns/op 2402.70 MB/s 0 B/op 0 allocs/op
167 | BenchmarkSip13Hash/256-40 20000000 92.9 ns/op 2755.47 MB/s 0 B/op 0 allocs/op
168 | BenchmarkSip13Hash/512-40 10000000 174 ns/op 2929.56 MB/s 0 B/op 0 allocs/op
169 | BenchmarkSip13Hash/1024-40 5000000 318 ns/op 3217.06 MB/s 0 B/op 0 allocs/op
170 | BenchmarkSip13Hash/4096-40 1000000 1257 ns/op 3257.99 MB/s 0 B/op 0 allocs/op
171 | BenchmarkSip13Hash/8192-40 500000 2557 ns/op 3203.58 MB/s 0 B/op 0 allocs/op
172 | BenchmarkFNV1/1-40 50000000 34.0 ns/op 29.42 MB/s 8 B/op 1 allocs/op
173 | BenchmarkFNV1/2-40 50000000 32.4 ns/op 61.74 MB/s 8 B/op 1 allocs/op
174 | BenchmarkFNV1/4-40 50000000 32.6 ns/op 122.54 MB/s 8 B/op 1 allocs/op
175 | BenchmarkFNV1/8-40 50000000 36.0 ns/op 222.36 MB/s 8 B/op 1 allocs/op
176 | BenchmarkFNV1/32-40 20000000 66.2 ns/op 483.33 MB/s 8 B/op 1 allocs/op
177 | BenchmarkFNV1/64-40 20000000 114 ns/op 560.53 MB/s 8 B/op 1 allocs/op
178 | BenchmarkFNV1/128-40 10000000 222 ns/op 574.65 MB/s 8 B/op 1 allocs/op
179 | BenchmarkFNV1/256-40 5000000 371 ns/op 688.21 MB/s 8 B/op 1 allocs/op
180 | BenchmarkFNV1/512-40 2000000 722 ns/op 708.90 MB/s 8 B/op 1 allocs/op
181 | BenchmarkFNV1/1024-40 1000000 1404 ns/op 728.99 MB/s 8 B/op 1 allocs/op
182 | BenchmarkFNV1/4096-40 300000 5156 ns/op 794.36 MB/s 8 B/op 1 allocs/op
183 | BenchmarkFNV1/8192-40 200000 10220 ns/op 801.49 MB/s 8 B/op 1 allocs/op
184 | BenchmarkT1ha/1-40 50000000 23.4 ns/op 42.71 MB/s 0 B/op 0 allocs/op
185 | BenchmarkT1ha/2-40 50000000 23.7 ns/op 84.46 MB/s 0 B/op 0 allocs/op
186 | BenchmarkT1ha/4-40 50000000 22.9 ns/op 174.67 MB/s 0 B/op 0 allocs/op
187 | BenchmarkT1ha/8-40 50000000 24.0 ns/op 333.26 MB/s 0 B/op 0 allocs/op
188 | BenchmarkT1ha/32-40 30000000 42.9 ns/op 745.50 MB/s 0 B/op 0 allocs/op
189 | BenchmarkT1ha/64-40 50000000 26.2 ns/op 2447.01 MB/s 0 B/op 0 allocs/op
190 | BenchmarkT1ha/128-40 30000000 39.0 ns/op 3280.46 MB/s 0 B/op 0 allocs/op
191 | BenchmarkT1ha/256-40 20000000 61.8 ns/op 4140.69 MB/s 0 B/op 0 allocs/op
192 | BenchmarkT1ha/512-40 20000000 101 ns/op 5034.86 MB/s 0 B/op 0 allocs/op
193 | BenchmarkT1ha/1024-40 10000000 191 ns/op 5342.89 MB/s 0 B/op 0 allocs/op
194 | BenchmarkT1ha/4096-40 2000000 713 ns/op 5740.65 MB/s 0 B/op 0 allocs/op
195 | BenchmarkT1ha/8192-40 1000000 1472 ns/op 5563.30 MB/s 0 B/op 0 allocs/op
196 | BenchmarkZaphod64/1-40 100000000 16.8 ns/op 59.44 MB/s 0 B/op 0 allocs/op
197 | BenchmarkZaphod64/2-40 100000000 17.4 ns/op 115.24 MB/s 0 B/op 0 allocs/op
198 | BenchmarkZaphod64/4-40 100000000 16.9 ns/op 236.02 MB/s 0 B/op 0 allocs/op
199 | BenchmarkZaphod64/8-40 100000000 18.0 ns/op 444.07 MB/s 0 B/op 0 allocs/op
200 | BenchmarkZaphod64/32-40 50000000 31.8 ns/op 1007.50 MB/s 0 B/op 0 allocs/op
201 | BenchmarkZaphod64/64-40 30000000 45.1 ns/op 1419.35 MB/s 0 B/op 0 allocs/op
202 | BenchmarkZaphod64/128-40 20000000 75.7 ns/op 1690.45 MB/s 0 B/op 0 allocs/op
203 | BenchmarkZaphod64/256-40 10000000 134 ns/op 1904.56 MB/s 0 B/op 0 allocs/op
204 | BenchmarkZaphod64/512-40 5000000 276 ns/op 1852.80 MB/s 0 B/op 0 allocs/op
205 | BenchmarkZaphod64/1024-40 3000000 473 ns/op 2161.56 MB/s 0 B/op 0 allocs/op
206 | BenchmarkZaphod64/4096-40 1000000 1896 ns/op 2160.23 MB/s 0 B/op 0 allocs/op
207 | BenchmarkZaphod64/8192-40 300000 3672 ns/op 2230.43 MB/s 0 B/op 0 allocs/op
208 | BenchmarkStadtx/1-40 100000000 12.1 ns/op 82.95 MB/s 0 B/op 0 allocs/op
209 | BenchmarkStadtx/2-40 100000000 12.0 ns/op 167.35 MB/s 0 B/op 0 allocs/op
210 | BenchmarkStadtx/4-40 100000000 11.6 ns/op 344.83 MB/s 0 B/op 0 allocs/op
211 | BenchmarkStadtx/8-40 100000000 13.1 ns/op 612.45 MB/s 0 B/op 0 allocs/op
212 | BenchmarkStadtx/32-40 100000000 17.6 ns/op 1818.04 MB/s 0 B/op 0 allocs/op
213 | BenchmarkStadtx/64-40 100000000 20.7 ns/op 3097.87 MB/s 0 B/op 0 allocs/op
214 | BenchmarkStadtx/128-40 50000000 27.9 ns/op 4582.23 MB/s 0 B/op 0 allocs/op
215 | BenchmarkStadtx/256-40 30000000 37.8 ns/op 6775.12 MB/s 0 B/op 0 allocs/op
216 | BenchmarkStadtx/512-40 20000000 74.8 ns/op 6848.73 MB/s 0 B/op 0 allocs/op
217 | BenchmarkStadtx/1024-40 20000000 110 ns/op 9274.26 MB/s 0 B/op 0 allocs/op
218 | BenchmarkStadtx/4096-40 5000000 378 ns/op 10818.66 MB/s 0 B/op 0 allocs/op
219 | BenchmarkStadtx/8192-40 2000000 717 ns/op 11417.63 MB/s 0 B/op 0 allocs/op
220 | BenchmarkTsip/1-40 100000000 11.8 ns/op 85.06 MB/s 0 B/op 0 allocs/op
221 | BenchmarkTsip/2-40 100000000 11.9 ns/op 168.10 MB/s 0 B/op 0 allocs/op
222 | BenchmarkTsip/4-40 100000000 13.1 ns/op 304.20 MB/s 0 B/op 0 allocs/op
223 | BenchmarkTsip/8-40 100000000 13.8 ns/op 579.09 MB/s 0 B/op 0 allocs/op
224 | BenchmarkTsip/32-40 100000000 19.1 ns/op 1677.52 MB/s 0 B/op 0 allocs/op
225 | BenchmarkTsip/64-40 50000000 27.4 ns/op 2333.65 MB/s 0 B/op 0 allocs/op
226 | BenchmarkTsip/128-40 30000000 45.1 ns/op 2840.10 MB/s 0 B/op 0 allocs/op
227 | BenchmarkTsip/256-40 20000000 80.0 ns/op 3199.60 MB/s 0 B/op 0 allocs/op
228 | BenchmarkTsip/512-40 10000000 139 ns/op 3667.91 MB/s 0 B/op 0 allocs/op
229 | BenchmarkTsip/1024-40 5000000 283 ns/op 3606.67 MB/s 0 B/op 0 allocs/op
230 | BenchmarkTsip/4096-40 1000000 1100 ns/op 3721.57 MB/s 0 B/op 0 allocs/op
231 | BenchmarkTsip/8192-40 1000000 2111 ns/op 3879.82 MB/s 0 B/op 0 allocs/op
232 | PASS
233 | ok github.com/kellabyte/go-benchmarks/hashing 391.451s
234 |
--------------------------------------------------------------------------------
/results/samples/hrtime.histogram:
--------------------------------------------------------------------------------
1 | Value Percentile TotalCount 1/(1-Percentile)
2 |
3 | 0.000000 0.000000 0 1.000000
4 | 17.000000 0.100000 10000000 1.111111
5 | 17.000000 0.200000 20000000 1.250000
6 | 17.000000 0.300000 30000000 1.428571
7 | 18.000000 0.400000 40000000 1.666667
8 | 19.000000 0.500000 50000000 2.000000
9 | 19.000000 0.550000 54999999 2.222222
10 | 19.000000 0.600000 59999999 2.500000
11 | 19.000000 0.650000 64999999 2.857143
12 | 19.000000 0.700000 69999999 3.333333
13 | 19.000000 0.750000 74999999 4.000000
14 | 19.000000 0.775000 77499999 4.444444
15 | 21.000000 0.800000 79999999 5.000000
16 | 21.000000 0.825000 82499999 5.714286
17 | 23.000000 0.850000 84999999 6.666667
18 | 23.000000 0.875000 87499999 8.000000
19 | 23.000000 0.887500 88749999 8.888889
20 | 23.000000 0.900000 89999999 10.000000
21 | 23.000000 0.912500 91249999 11.428571
22 | 23.000000 0.925000 92499999 13.333333
23 | 23.000000 0.937500 93749999 16.000000
24 | 23.000000 0.943750 94374999 17.777778
25 | 23.000000 0.950000 94999999 20.000000
26 | 23.000000 0.956250 95624999 22.857143
27 | 24.000000 0.962500 96249999 26.666667
28 | 24.000000 0.968750 96874999 32.000000
29 | 24.000000 0.971875 97187499 35.555556
30 | 24.000000 0.975000 97499999 40.000000
31 | 24.000000 0.978125 97812499 45.714286
32 | 24.000000 0.981250 98124999 53.333333
33 | 24.000000 0.984375 98437499 64.000000
34 | 24.000000 0.985938 98593799 71.113640
35 | 24.000000 0.987500 98749999 80.000000
36 | 24.000000 0.989062 98906199 91.424392
37 | 24.000000 0.990625 99062499 106.666667
38 | 24.000000 0.992188 99218799 128.008193
39 | 24.000000 0.992969 99296899 142.227279
40 | 24.000000 0.993750 99374999 160.000000
41 | 24.000000 0.994531 99453099 182.848784
42 | 26.000000 0.995313 99531299 213.356091
43 | 84.000000 0.996094 99609399 256.016385
44 | 91.000000 0.996484 99648399 284.414107
45 | 101.000000 0.996875 99687499 320.000000
46 | 105.000000 0.997266 99726599 365.764448
47 | 108.000000 0.997656 99765599 426.621160
48 | 111.000000 0.998047 99804699 512.032770
49 | 111.000000 0.998242 99824199 568.828214
50 | 112.000000 0.998437 99843699 639.795266
51 | 113.000000 0.998633 99863299 731.528895
52 | 115.000000 0.998828 99882799 853.242321
53 | 117.000000 0.999023 99902299 1023.541453
54 | 117.000000 0.999121 99912099 1137.656428
55 | 118.000000 0.999219 99921899 1280.409731
56 | 119.000000 0.999316 99931599 1461.988304
57 | 121.000000 0.999414 99941399 1706.484642
58 | 123.000000 0.999512 99951199 2049.180328
59 | 128.000000 0.999561 99956099 2277.904328
60 | 239.000000 0.999609 99960899 2557.544757
61 | 259.000000 0.999658 99965799 2923.976608
62 | 263.000000 0.999707 99970699 3412.969283
63 | 268.000000 0.999756 99975599 4098.360656
64 | 273.000000 0.999780 99977999 4545.454545
65 | 276.000000 0.999805 99980499 5128.205128
66 | 277.000000 0.999829 99982899 5847.953216
67 | 278.000000 0.999854 99985399 6849.315068
68 | 280.000000 0.999878 99987799 8196.721311
69 | 291.000000 0.999890 99988999 9090.909091
70 | 295.000000 0.999902 99990199 10204.081633
71 | 298.000000 0.999915 99991499 11764.705882
72 | 300.000000 0.999927 99992699 13698.630137
73 | 307.000000 0.999939 99993899 16393.442623
74 | 310.000000 0.999945 99994499 18181.818182
75 | 311.000000 0.999951 99995099 20408.163265
76 | 312.000000 0.999957 99995699 23255.813953
77 | 312.000000 0.999963 99996299 27027.027027
78 | 313.000000 0.999969 99996899 32258.064516
79 | 314.000000 0.999973 99997299 37037.037037
80 | 316.000000 0.999976 99997599 41666.666667
81 | 323.000000 0.999979 99997899 47619.047619
82 | 337.000000 0.999982 99998199 55555.555555
83 | 353.000000 0.999985 99998499 66666.666667
84 | 358.000000 0.999986 99998599 71428.571428
85 | 368.000000 0.999988 99998799 83333.333333
86 | 373.000000 0.999989 99998899 90909.090909
87 | 1465.000000 0.999991 99999099 111111.111111
88 | 2352.000000 0.999992 99999199 125000.000000
89 | 2540.000000 0.999993 99999299 142857.142858
90 | 2854.000000 0.999994 99999399 166666.666665
91 | 3219.000000 0.999995 99999499 199999.999999
92 | 4760.000000 0.999996 99999599 250000.000000
93 | 12070.000000 0.999997 99999699 333333.333336
94 | 12320.000000 0.999998 99999799 499999.999986
95 | 12707.000000 0.999999 99999899 999999.999971
96 | 124715.000000 1.000000 99999999 10000000.000000
97 |
--------------------------------------------------------------------------------
/results/samples/nanotime.histogram:
--------------------------------------------------------------------------------
1 | Value Percentile TotalCount 1/(1-Percentile)
2 |
3 | 0.000000 0.000000 0 1.000000
4 | 21.000000 0.100000 2000000 1.111111
5 | 21.000000 0.200000 4000000 1.250000
6 | 22.000000 0.300000 6000000 1.428571
7 | 22.000000 0.400000 8000000 1.666667
8 | 22.000000 0.500000 10000000 2.000000
9 | 22.000000 0.550000 11000000 2.222222
10 | 22.000000 0.600000 12000000 2.500000
11 | 22.000000 0.650000 13000000 2.857143
12 | 22.000000 0.700000 14000000 3.333333
13 | 22.000000 0.750000 15000000 4.000000
14 | 22.000000 0.775000 15500000 4.444444
15 | 22.000000 0.800000 16000000 5.000000
16 | 22.000000 0.825000 16500000 5.714286
17 | 23.000000 0.850000 17000000 6.666667
18 | 24.000000 0.875000 17500000 8.000000
19 | 26.000000 0.887500 17750000 8.888889
20 | 26.000000 0.900000 18000000 10.000000
21 | 27.000000 0.912500 18250000 11.428571
22 | 27.000000 0.925000 18500000 13.333333
23 | 27.000000 0.937500 18750000 16.000000
24 | 27.000000 0.943750 18875000 17.777778
25 | 27.000000 0.950000 19000000 20.000000
26 | 27.000000 0.956250 19125000 22.857143
27 | 29.000000 0.962500 19250000 26.666667
28 | 29.000000 0.968750 19375000 32.000000
29 | 29.000000 0.971875 19437500 35.555556
30 | 30.000000 0.975000 19500000 40.000000
31 | 30.000000 0.978125 19562500 45.714286
32 | 30.000000 0.981250 19625000 53.333333
33 | 31.000000 0.984375 19687500 64.000000
34 | 31.000000 0.985938 19718760 71.113640
35 | 31.000000 0.987500 19750000 80.000000
36 | 32.000000 0.989062 19781240 91.424392
37 | 33.000000 0.990625 19812500 106.666667
38 | 34.000000 0.992188 19843760 128.008193
39 | 34.000000 0.992969 19859380 142.227279
40 | 34.000000 0.993750 19875000 160.000000
41 | 35.000000 0.994531 19890620 182.848784
42 | 57.000000 0.995313 19906260 213.356091
43 | 60.000000 0.996094 19921880 256.016385
44 | 60.000000 0.996484 19929680 284.414107
45 | 60.000000 0.996875 19937500 320.000000
46 | 60.000000 0.997266 19945320 365.764448
47 | 60.000000 0.997656 19953120 426.621160
48 | 1530.000000 0.998047 19960940 512.032770
49 | 1541.000000 0.998242 19964840 568.828214
50 | 1545.000000 0.998437 19968740 639.795266
51 | 1548.000000 0.998633 19972660 731.528895
52 | 1551.000000 0.998828 19976560 853.242321
53 | 1554.000000 0.999023 19980460 1023.541453
54 | 1556.000000 0.999121 19982420 1137.656428
55 | 1559.000000 0.999219 19984380 1280.409731
56 | 1563.000000 0.999316 19986320 1461.988304
57 | 1570.000000 0.999414 19988280 1706.484642
58 | 1589.000000 0.999512 19990240 2049.180328
59 | 1617.000000 0.999561 19991220 2277.904328
60 | 1669.000000 0.999609 19992180 2557.544757
61 | 1680.000000 0.999658 19993160 2923.976608
62 | 1689.000000 0.999707 19994140 3412.969283
63 | 1721.000000 0.999756 19995120 4098.360656
64 | 1762.000000 0.999780 19995600 4545.454545
65 | 1800.000000 0.999805 19996100 5128.205128
66 | 1847.000000 0.999829 19996580 5847.953216
67 | 1897.000000 0.999854 19997080 6849.315068
68 | 1942.000000 0.999878 19997560 8196.721311
69 | 1965.000000 0.999890 19997800 9090.909091
70 | 2060.000000 0.999902 19998040 10204.081633
71 | 2150.000000 0.999915 19998300 11764.705882
72 | 2763.000000 0.999927 19998540 13698.630137
73 | 3235.000000 0.999939 19998780 16393.442623
74 | 3370.000000 0.999945 19998900 18181.818182
75 | 3469.000000 0.999951 19999020 20408.163265
76 | 3608.000000 0.999957 19999140 23255.813953
77 | 3759.000000 0.999963 19999260 27027.027027
78 | 3903.000000 0.999969 19999380 32258.064516
79 | 3989.000000 0.999973 19999460 37037.037037
80 | 4072.000000 0.999976 19999520 41666.666667
81 | 4153.000000 0.999979 19999580 47619.047619
82 | 4242.000000 0.999982 19999640 55555.555555
83 | 4357.000000 0.999985 19999700 66666.666667
84 | 4386.000000 0.999986 19999720 71428.571428
85 | 4463.000000 0.999988 19999760 83333.333333
86 | 4489.000000 0.999989 19999780 90909.090909
87 | 4603.000000 0.999991 19999820 111111.111111
88 | 4653.000000 0.999992 19999840 125000.000000
89 | 4708.000000 0.999993 19999860 142857.142858
90 | 4761.000000 0.999994 19999880 166666.666665
91 | 4851.000000 0.999995 19999900 199999.999999
92 | 5037.000000 0.999996 19999920 250000.000000
93 | 5293.000000 0.999997 19999940 333333.333336
94 | 6911.000000 0.999998 19999960 499999.999986
95 | 12045.000000 0.999999 19999980 999999.999971
96 | 135190.000000 1.000000 20000000 10000000.000000
97 |
--------------------------------------------------------------------------------
/results/samples/onering.histogram:
--------------------------------------------------------------------------------
1 | Value Percentile TotalCount 1/(1-Percentile)
2 |
3 | 0.000000 0.000000 0 1.000000
4 | 33.000000 0.100000 2000000 1.111111
5 | 34.000000 0.200000 4000000 1.250000
6 | 35.000000 0.300000 6000000 1.428571
7 | 36.000000 0.400000 8000000 1.666667
8 | 38.000000 0.500000 10000000 2.000000
9 | 42.000000 0.550000 11000000 2.222222
10 | 65.000000 0.600000 12000000 2.500000
11 | 67.000000 0.650000 13000000 2.857143
12 | 69.000000 0.700000 14000000 3.333333
13 | 70.000000 0.750000 15000000 4.000000
14 | 72.000000 0.775000 15500000 4.444444
15 | 74.000000 0.800000 16000000 5.000000
16 | 98.000000 0.825000 16500000 5.714286
17 | 105.000000 0.850000 17000000 6.666667
18 | 107.000000 0.875000 17500000 8.000000
19 | 109.000000 0.887500 17750000 8.888889
20 | 110.000000 0.900000 18000000 10.000000
21 | 111.000000 0.912500 18250000 11.428571
22 | 112.000000 0.925000 18500000 13.333333
23 | 113.000000 0.937500 18750000 16.000000
24 | 114.000000 0.943750 18875000 17.777778
25 | 114.000000 0.950000 19000000 20.000000
26 | 115.000000 0.956250 19125000 22.857143
27 | 116.000000 0.962500 19250000 26.666667
28 | 118.000000 0.968750 19375000 32.000000
29 | 120.000000 0.971875 19437500 35.555556
30 | 126.000000 0.975000 19500000 40.000000
31 | 144.000000 0.978125 19562500 45.714286
32 | 151.000000 0.981250 19625000 53.333333
33 | 156.000000 0.984375 19687500 64.000000
34 | 158.000000 0.985938 19718760 71.113640
35 | 160.000000 0.987500 19750000 80.000000
36 | 162.000000 0.989062 19781240 91.424392
37 | 164.000000 0.990625 19812500 106.666667
38 | 167.000000 0.992188 19843760 128.008193
39 | 170.000000 0.992969 19859380 142.227279
40 | 174.000000 0.993750 19875000 160.000000
41 | 180.000000 0.994531 19890620 182.848784
42 | 186.000000 0.995313 19906260 213.356091
43 | 194.000000 0.996094 19921880 256.016385
44 | 200.000000 0.996484 19929680 284.414107
45 | 206.000000 0.996875 19937500 320.000000
46 | 216.000000 0.997266 19945320 365.764448
47 | 229.000000 0.997656 19953120 426.621160
48 | 237.000000 0.998047 19960940 512.032770
49 | 240.000000 0.998242 19964840 568.828214
50 | 246.000000 0.998437 19968740 639.795266
51 | 253.000000 0.998633 19972660 731.528895
52 | 262.000000 0.998828 19976560 853.242321
53 | 274.000000 0.999023 19980460 1023.541453
54 | 283.000000 0.999121 19982420 1137.656428
55 | 294.000000 0.999219 19984380 1280.409731
56 | 305.000000 0.999316 19986320 1461.988304
57 | 328.000000 0.999414 19988280 1706.484642
58 | 359.000000 0.999512 19990240 2049.180328
59 | 372.000000 0.999561 19991220 2277.904328
60 | 378.000000 0.999609 19992180 2557.544757
61 | 381.000000 0.999658 19993160 2923.976608
62 | 383.000000 0.999707 19994140 3412.969283
63 | 386.000000 0.999756 19995120 4098.360656
64 | 391.000000 0.999780 19995600 4545.454545
65 | 401.000000 0.999805 19996100 5128.205128
66 | 409.000000 0.999829 19996580 5847.953216
67 | 412.000000 0.999854 19997080 6849.315068
68 | 415.000000 0.999878 19997560 8196.721311
69 | 418.000000 0.999890 19997800 9090.909091
70 | 422.000000 0.999902 19998040 10204.081633
71 | 437.000000 0.999915 19998300 11764.705882
72 | 445.000000 0.999927 19998540 13698.630137
73 | 453.000000 0.999939 19998780 16393.442623
74 | 461.000000 0.999945 19998900 18181.818182
75 | 472.000000 0.999951 19999020 20408.163265
76 | 518.000000 0.999957 19999140 23255.813953
77 | 1340.000000 0.999963 19999260 27027.027027
78 | 3583.000000 0.999969 19999380 32258.064516
79 | 4226.000000 0.999973 19999460 37037.037037
80 | 4759.000000 0.999976 19999520 41666.666667
81 | 5389.000000 0.999979 19999580 47619.047619
82 | 6334.000000 0.999982 19999640 55555.555555
83 | 8306.000000 0.999985 19999700 66666.666667
84 | 9119.000000 0.999986 19999720 71428.571428
85 | 9728.000000 0.999988 19999760 83333.333333
86 | 9938.000000 0.999989 19999780 90909.090909
87 | 10781.000000 0.999991 19999820 111111.111111
88 | 11691.000000 0.999992 19999840 125000.000000
89 | 12149.000000 0.999993 19999860 142857.142858
90 | 12278.000000 0.999994 19999880 166666.666665
91 | 12424.000000 0.999995 19999900 199999.999999
92 | 12516.000000 0.999996 19999920 250000.000000
93 | 12674.000000 0.999997 19999940 333333.333336
94 | 12863.000000 0.999998 19999960 499999.999986
95 | 13064.000000 0.999999 19999980 999999.999971
96 | 125611.000000 1.000000 20000000 10000000.000000
97 |
--------------------------------------------------------------------------------
/results/samples/queues.log:
--------------------------------------------------------------------------------
1 | goos: linux
2 | goarch: amd64
3 | pkg: github.com/kellabyte/go-benchmarks/queues
4 | Benchmark1Producer1ConsumerChannel-40 10000000 182 ns/op 5.48 MB/s 0 B/op 0 allocs/op
5 | Benchmark1Producer1ConsumerDiode-40 10000000 187 ns/op 5.35 MB/s 15 B/op 0 allocs/op
6 | Benchmark1Producer1ConsumerFastlane-40 20000000 117 ns/op 8.48 MB/s 16 B/op 1 allocs/op
7 | Benchmark1Producer1ConsumerOneRing-40 20000000 85.9 ns/op 11.64 MB/s 0 B/op 0 allocs/op
8 | PASS
9 | ok github.com/kellabyte/go-benchmarks/queues 21.334s
10 |
--------------------------------------------------------------------------------
/results/samples/time.log:
--------------------------------------------------------------------------------
1 | goos: linux
2 | goarch: amd64
3 | pkg: github.com/kellabyte/go-benchmarks/time
4 | BenchmarkNanotime-40 20000000 55.0 ns/op 18.20 MB/s 0 B/op 0 allocs/op
5 | BenchmarkHrtime-40 100000000 21.3 ns/op 46.98 MB/s 0 B/op 0 allocs/op
6 | PASS
7 | ok github.com/kellabyte/go-benchmarks/time 8.943s
8 |
--------------------------------------------------------------------------------
/results/time.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kellabyte/go-benchmarks/36847db9ae394cc7d8e6d040e977f03c597998c4/results/time.png
--------------------------------------------------------------------------------
/results/time_p90.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kellabyte/go-benchmarks/36847db9ae394cc7d8e6d040e977f03c597998c4/results/time_p90.png
--------------------------------------------------------------------------------
/results/time_p99.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kellabyte/go-benchmarks/36847db9ae394cc7d8e6d040e977f03c597998c4/results/time_p99.png
--------------------------------------------------------------------------------
/results/time_p999.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kellabyte/go-benchmarks/36847db9ae394cc7d8e6d040e977f03c597998c4/results/time_p999.png
--------------------------------------------------------------------------------
/results/time_p9999.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kellabyte/go-benchmarks/36847db9ae394cc7d8e6d040e977f03c597998c4/results/time_p9999.png
--------------------------------------------------------------------------------
/results/time_p99999.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kellabyte/go-benchmarks/36847db9ae394cc7d8e6d040e977f03c597998c4/results/time_p99999.png
--------------------------------------------------------------------------------
/results/time_p999999.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kellabyte/go-benchmarks/36847db9ae394cc7d8e6d040e977f03c597998c4/results/time_p999999.png
--------------------------------------------------------------------------------
/time/README.md:
--------------------------------------------------------------------------------
1 | # Introduction
2 | This directory includes timestamp benchmarks for various different time stamp functions.
3 |
4 | # Guarantees
5 | Different time functions have different tradeoffs.
6 |
7 | ### Staleness
8 | _TODO_
9 |
10 | # Setup
11 | ```
12 | Ubuntu Linux
13 | Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz x 20 Cores (40 Hyperthreaded)
14 | L1 Cache: 320 kB
15 | L2 Cache: 2560 kB
16 | L3 Cache: 25600 kB
17 | Memory: 126 GB
18 | ```
19 |
20 | # Results
21 | [](https://github.com/kellabyte/go-benchmarks/raw/master/results/time.png)
22 |
23 | ### p90
24 | [](https://github.com/kellabyte/go-benchmarks/raw/master/results/time_p90.png)
25 | ### p99
26 | [](https://github.com/kellabyte/go-benchmarks/raw/master/results/time_p99.png)
27 | ### p999
28 | [](https://github.com/kellabyte/go-benchmarks/raw/master/results/time_p999.png)
29 | ### p9999
30 | [](https://github.com/kellabyte/go-benchmarks/raw/master/results/time_p9999.png)
31 | ### p99999
32 | [](https://github.com/kellabyte/go-benchmarks/raw/master/results/time_p99999.png)
33 | ### p999999
34 | [](https://github.com/kellabyte/go-benchmarks/raw/master/results/time_p99999.png)
35 | ### p9999999
36 | [](https://github.com/kellabyte/go-benchmarks/raw/master/results/time_p999999.png)
37 |
38 | ```
39 | make queues
40 |
41 | goos: linux
42 | goarch: amd64
43 | pkg: github.com/kellabyte/go-benchmarks/time
44 | BenchmarkNanotime-40 20000000 59.4 ns/op 16.82 MB/s 0 B/op 0 allocs/op
45 | BenchmarkHrtime-40 100000000 21.4 ns/op 46.76 MB/s 0 B/op 0 allocs/op
46 | PASS
47 | ok github.com/kellabyte/go-benchmarks/time 11.010s
48 | ```
--------------------------------------------------------------------------------
/time/nanos.s:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kellabyte/go-benchmarks/36847db9ae394cc7d8e6d040e977f03c597998c4/time/nanos.s
--------------------------------------------------------------------------------
/time/time_test.go:
--------------------------------------------------------------------------------
1 | //go:linkname nanotime runtime.nanotime
2 | package time
3 |
4 | import (
5 | "testing"
6 | _ "unsafe"
7 |
8 | "github.com/codahale/hdrhistogram"
9 | "github.com/loov/hrtime"
10 | "github.com/tylertreat/hdrhistogram-writer"
11 | )
12 |
13 | func nanotime() int64
14 |
15 | func BenchmarkNanotime(b *testing.B) {
16 | startNanos := make([]int64, b.N)
17 | endNanos := make([]int64, b.N)
18 |
19 | b.ResetTimer()
20 | for i := 0; i < b.N; i++ {
21 | startNanos[i] = nanotime()
22 | endNanos[i] = nanotime()
23 | b.SetBytes(1)
24 | }
25 |
26 | b.StopTimer()
27 | recordLatencyDistribution("nanotime", b.N, startNanos, endNanos)
28 | }
29 |
30 | func BenchmarkHrtime(b *testing.B) {
31 | bench := hrtime.NewBenchmarkTSC(b.N)
32 |
33 | b.ResetTimer()
34 | for bench.Next() {
35 | b.SetBytes(1)
36 | }
37 |
38 | b.StopTimer()
39 | recordLatencyDistributionBenchmark("hrtime", bench)
40 | }
41 |
42 | func recordLatencyDistribution(name string, count int, startNanos []int64, endNanos []int64) {
43 | histogram := hdrhistogram.New(1, 1000000, 5)
44 | for i := 0; i < count; i++ {
45 | diff := endNanos[i] - startNanos[i]
46 | histogram.RecordValue(diff)
47 | }
48 | histwriter.WriteDistributionFile(histogram, nil, 1.0, "../results/"+name+".histogram")
49 | }
50 |
51 | func recordLatencyDistributionBenchmark(name string, bench *hrtime.BenchmarkTSC) {
52 | histogram := hdrhistogram.New(1, 1000000, 5)
53 | for _, lap := range bench.Laps() {
54 | histogram.RecordValue(int64(lap))
55 | }
56 | histwriter.WriteDistributionFile(histogram, nil, 1.0, "../results/"+name+".histogram")
57 | }
58 |
--------------------------------------------------------------------------------