-
Notifications
You must be signed in to change notification settings - Fork 295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Codec import adds huge bloat #295
Comments
Yes, Basically, generated code increases the size of the package. Generated code occurs when we generate the fastpath helpers, and when users explicitly use codegeneration. To override using the fastpath, build with the tag However, be aware that a significant performance benefits occurs from its use. For example, look at the examples below running benchmarks with and without notfast path: cd bench
go test -run Nothing -bench Benchmark__Cbor_______Decode -benchmem -benchtime 5s -tags ""
go test -run Nothing -bench Benchmark__Cbor_______Decode -benchmem -benchtime 5s -tags "notfastpath" results:
As you can see, at least in this representative benchmark, we get about 33% increase in time per decode operation. Of course, YMMV. And the reduction in size may be worth it, and also most of the types supported in the fastpath may be unnecessary for your use-case. |
…t.Sort wrappers We no longer generate fast-paths for maps with - keys of type int8/16/32, uint16/32, float32/64, bool, interface{} - values of type int8/16/32, uint16/32 This is in a bid to reduce the binary size for types which depend on go-codec. Previously, go-codec was adding about 11MB to a binary. We have now reduce that to 5.7MB. The user has the option to reduce this further to 2.9MB by passing the tag 'notfastpath' during a build or install. In addition, we now generate sort.Sort wrappers for types we care about. This way, we don't have to maintain the code manually. In generated fast-path and other code, we also reduced the amount of unnecessary conversions we do. Updates #295 Updates cisco/senml#22 Fixes #296
Looks like codec import makes binaries to be huge:
Typically, binary that was expected to be ~3-4MB in size wight now 14MB just because it imports codec.
The text was updated successfully, but these errors were encountered: