Skip to content
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

Reduce allocations in streaming decoder #79

Closed
tj opened this issue May 14, 2017 · 1 comment
Closed

Reduce allocations in streaming decoder #79

tj opened this issue May 14, 2017 · 1 comment

Comments

@tj
Copy link
Contributor

tj commented May 14, 2017

First of all this is awesome! Thanks a lot for the package.

I haven't looked heavily yet but the msgp package seems to decode roughly ~70% faster given the same structure, which seems a little odd since one goal of capnproto is to reduce the allocations (and msgp has to construct everything).

I was thinking maybe splitting the framing out of the decoder so that Unmarshal can be used, allowing the user to decide whether or not it's safe to reference the memory. My main use-case for analytical type stuff where you just want to iterate and grab a field or two in-place.

Any thoughts? Maybe I missed an API in there, but it looked like the framing was built directly into the decoder.

IIRC msgp allows you to unmarshal against an existing byte slice (or allocs if necessary), I think it makes use of that pretty heavily internally which might be why it's quicker in this case.

cheers

@zombiezen
Copy link
Contributor

Do you have a Go-style benchmark where you can show the issue? This library doesn't have nearly enough.

@tj tj mentioned this issue May 16, 2017
zombiezen pushed a commit that referenced this issue May 18, 2017
* Comparison benchmarks with MsgPack behind `msgpbench` build tag
* Add @tj to AUTHORS / CONTRIBUTORS

Addresses #79
@zombiezen zombiezen modified the milestone: 2.15 Jun 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants