Skip to content

Instantly share code, notes, and snippets.

View Synaxis's full-sized avatar
🎯
Focusing

Caio A. Torquato Synaxis

🎯
Focusing
View GitHub Profile
@piotrkubisa
piotrkubisa / calc.go
Last active August 29, 2017 20:08
Benchmark - Calculate the Content-length from io.Reader stream
package calc
import (
"bytes"
"io"
"io/ioutil"
)
func BufferLen(r io.Reader) int {
var buf bytes.Buffer
@smagch
smagch / README.md
Last active February 18, 2019 08:17
Golang: map vs struct loopkup benchmark
BenchmarkStruct1	50000000	        41.1 ns/op
BenchmarkMap1	50000000	        43.5 ns/op
BenchmarkStruct2	50000000	        42.8 ns/op
BenchmarkMap2	50000000	        44.4 ns/op
BenchmarkStruct3	50000000	        45.3 ns/op
BenchmarkMap3	50000000	        37.0 ns/op
BenchmarkStruct4	50000000	        42.2 ns/op
BenchmarkMap4	50000000	        37.3 ns/op