-
Notifications
You must be signed in to change notification settings - Fork 296
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.(*simpleIoEncWriterWriter).WriteByte generating a lot of garbage #143
Comments
Good idea per the WriteByte optimization. Will do. simpleIoEncWriterWriter is not scoped, so we can cache a 1-element byte array, and use it all the time when writing a byte. We can't do anything for msgpack.DecodeString. We can't control who calls DecodeString, so doing a stringView at that point is not an option. Consequently, we have to do a conversion (which implicitly does an allocation and copy). Fix coming in a few. |
BTW, bw is nil because the Writer passed to Encode in not a ByteWriter. |
Thanks!!! On Sunday, February 21, 2016, Ugorji Nwoke [email protected] wrote:
|
One final note regarding I know that
You can find the generated code for most (if not all) the types involved here at: https://gist.github.com/2opremio/0956c1e883b89eba71a9 |
I have also taken a deeper look at the Scope app This case is particularly bad, since it won't even get fixed when compiling with
|
Those calls are likely reading a value to set a struct field e.g. struct {S On Sun, Feb 21, 2016 at 2:17 PM, Alfonso Acosta [email protected]
|
To reduce garbage from simpleIoEncWriterWriter (ugorji/go#143)
After migrating the codecs of https://github.com/weaveworks/scope/ to github.com/ugorji/go I am looking at the garbage generated:
(This comes from the Scope probe, weaveworks/scope#812 (comment) for the raw profile file and a complete graph)
It seems we could win a bit by optimizing
codec.(*simpleIoEncWriterWriter).WriteByte()
(and compiling with-tags unsafe
). @ugorji Do you know what is causing bw to be nil? If that's not easily solvable, could you at least cache that slice?Also, (although it has a lower impact for us) it may be worth optimizing
codec.(*msgpackDecDriver).DecodeString()
:(This comes from the Scope app, see weaveworks/scope#854 (comment) for the raw profile file and a complete graph).
The text was updated successfully, but these errors were encountered: