-
Notifications
You must be signed in to change notification settings - Fork 173
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
[PERF] Further performance improvements discussion #189
Comments
@richardartoul, thanks for opening this issue. I'm happy to discuss how to improve performance in this library. I'll address these in bullets, corresponding to each bullet you wrote:
|
@jhump Regarding #4 correct thats what I would need. I guess my comment was more around whether or not I could introduce such an iterator into this library (so that I could re-use a lot of the logic you've already written). With recent optimizations the largest bottleneck in my code right now is the |
Can you not use the exported If not, I don't think a wrapper belongs in the If forking is really that bad of an option, let's first decide where to put this. Maybe a new sub-package in this repo? |
I didn't know about Forking isn't terrible, just seems like I'll be copying a lot of your code, but maybe it won't be so bad. How about I start by forking / copying and pasting and see how far I get and then if I reach a point where I think what I have is worth upstreaming or would be beneficial to this library we can talk about it then? It seems like you might be right though. |
@richardartoul, SGTM |
I totally understand not wanting to fork. (I made the same appeal to the protobuf project.) I just hesitate to make this repo the home for that. That being said, I'm not necessarily opposed to it. I just want to make sure it's been thought through before adding it. |
@richardartoul, I think I may be flip-flopping regarding a public API for the binary protobuf format. I now have need for something similar, too, outside of this repo. So I'm now thinking of the same thing you were: wanting a single, shared public API to use. So I've created a candidate for this exported API with #196. I need to write some more tests before I could merge that PR. I'm also still debating whether this is the right place for such a package. I think I'll start with following my own advice about forking it in my other project and see how that goes. That will give some time to think about this API a bit and decide whether to merge a new If you're curious about the API I've proposed, take a look at the PR and let me know what you think. The |
I took a look. It seems like mostly you've just made the buffer public (and a few new APIs like For context on what I'm doing with it, this is my P.R: m3db/m3#1597 Basically There is also an explanation in I tried to implement it as an iterator at first but it didn't work out since my use-cases requires knowing if the stream is completely valid before doing anything else with it since rolling back is difficult |
I have a couple more ideas for performance improvements and am wondering how you feel about all of the following:
m.values
could become[]interface{}
m.GetInt64FieldByFieldNumber(fieldNum)
. My profiling shows that the library spends a lot of time allocating (and collecting)interface{}
. We could alleviate this a lot by adding support for typed APIs and then using union types internally for storing the data.[]byte
to be controlled. Right now I have no control on how[]byte
fields will be allocated. It would be nice if I could configure my own allocation function or somehow indicate that I would rather the library take a subslice of the buffer its marshaling from instead of allocating a new one.codedBuffer
andm.unmarshal
method do internally where I could have an iterator that reads the stream and gives me the value of each field one at a time. That would probably make a huge performance improvement for my workload.I realize that these changes may not align with your vision for the library so just wanted to get your thoughts.
The text was updated successfully, but these errors were encountered: