gopkg
gopkg copied to clipboard
feat: use runtime.rawstring to make bytes without clear memory
tiger@xxx:~/xiezhengyao/github.com/jayantxie/gopkg/lang/dirtmake$ GOMAXPROCS=1 GOGC=1000 go test -v -bench=. -benchmem -benchtime=5s
goos: linux
goarch: amd64
pkg: github.com/bytedance/gopkg/lang/dirtmake
cpu: Intel(R) Xeon(R) Gold 5118 CPU @ 2.30GHz
BenchmarkFastMake
BenchmarkFastMake/size=1024
BenchmarkFastMake/size=1024 75632510 80.88 ns/op 1024 B/op 1 allocs/op
BenchmarkFastMake/size=3072
BenchmarkFastMake/size=3072 56139994 104.1 ns/op 3072 B/op 1 allocs/op
BenchmarkFastMake/size=5120
BenchmarkFastMake/size=5120 25204423 213.5 ns/op 5376 B/op 1 allocs/op
BenchmarkFastMake/size=7168
BenchmarkFastMake/size=7168 12370452 498.2 ns/op 8192 B/op 1 allocs/op
BenchmarkFastMake/size=9216
BenchmarkFastMake/size=9216 35381056 177.0 ns/op 9472 B/op 1 allocs/op
BenchmarkFastMake/size=11264
BenchmarkFastMake/size=11264 15790495 371.2 ns/op 12288 B/op 1 allocs/op
BenchmarkFastMake/size=13312
BenchmarkFastMake/size=13312 24623552 282.5 ns/op 13568 B/op 1 allocs/op
BenchmarkFastMake/size=15360
BenchmarkFastMake/size=15360 8764629 650.0 ns/op 16384 B/op 1 allocs/op
BenchmarkFastMake/size=17408
BenchmarkFastMake/size=17408 21286158 324.7 ns/op 18432 B/op 1 allocs/op
BenchmarkFastMake/size=19456
BenchmarkFastMake/size=19456 15668707 420.1 ns/op 20480 B/op 1 allocs/op
BenchmarkOriginMake
BenchmarkOriginMake/size=1024
BenchmarkOriginMake/size=1024 27477183 207.9 ns/op 1024 B/op 1 allocs/op
BenchmarkOriginMake/size=3072
BenchmarkOriginMake/size=3072 7992910 742.3 ns/op 3072 B/op 1 allocs/op
BenchmarkOriginMake/size=5120
BenchmarkOriginMake/size=5120 4515583 1307 ns/op 5376 B/op 1 allocs/op
BenchmarkOriginMake/size=7168
BenchmarkOriginMake/size=7168 2712064 2203 ns/op 8192 B/op 1 allocs/op
BenchmarkOriginMake/size=9216
BenchmarkOriginMake/size=9216 3215642 1868 ns/op 9472 B/op 1 allocs/op
BenchmarkOriginMake/size=11264
BenchmarkOriginMake/size=11264 2260072 2579 ns/op 12288 B/op 1 allocs/op
BenchmarkOriginMake/size=13312
BenchmarkOriginMake/size=13312 2234844 2655 ns/op 13568 B/op 1 allocs/op
BenchmarkOriginMake/size=15360
BenchmarkOriginMake/size=15360 1659430 3624 ns/op 16384 B/op 1 allocs/op
BenchmarkOriginMake/size=17408
BenchmarkOriginMake/size=17408 1748785 3348 ns/op 18432 B/op 1 allocs/op
BenchmarkOriginMake/size=19456
BenchmarkOriginMake/size=19456 1513047 3991 ns/op 20480 B/op 1 allocs/op
PASS
ok github.com/bytedance/gopkg/lang/dirtmake 151.884s