-
-
Notifications
You must be signed in to change notification settings - Fork 108
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
Labels
Milestone
Comments
Do you have a Go-style benchmark where you can show the issue? This library doesn't have nearly enough. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
The text was updated successfully, but these errors were encountered: