whyrusleeping / cbor-gen

Codegen for cbor codecs on your types
MIT License
35 stars 25 forks source link

attempt to allocate less by using shared buffers #18

Closed whyrusleeping closed 4 years ago

whyrusleeping commented 4 years ago

Working on reusing buffers to avoid more allocations

whyrusleeping commented 4 years ago
goos: linux
goarch: amd64
pkg: github.com/whyrusleeping/cbor-gen/testing
BenchmarkMarshaling-12        397550          3061 ns/op        1248 B/op         62 allocs/op
PASS
ok      github.com/whyrusleeping/cbor-gen/testing   2.190s
why@whynix ~/c/cbor-gen (feat/some-shared-buffers)> go test ./testing -bench=.
goos: linux
goarch: amd64
pkg: github.com/whyrusleeping/cbor-gen/testing
BenchmarkMarshaling-12        877396          1226 ns/op         240 B/op         15 allocs/op
PASS
ok      github.com/whyrusleeping/cbor-gen/testing   2.024s