-
Notifications
You must be signed in to change notification settings - Fork 68
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
Use JSON decoder tokenizer to parse packages from storage indexer #881
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can probably be further improved by directly applying the transformations on the parsed packages. It could be also nice to benchmark just this function and not the whole Init process, though this is the heaviest part of this process.
I wouldn't preoptimize it. This is already a decent result. Let's deploy it in the cloud and see how it goes.
Ok, but I am leaving the comment, I think this is something that we should try, this will also save some memory. |
Frankly speaking, I'm wondering if that isn't supported by jsoniter. What you're doing here is iterating over next objects. |
Ok, I have tried to apply the transforms in place and surprisingly (to me 🙂) the results don't vary a lot, so let's keep it like this.
We could also give it a try, I will wait before merging this. |
Ok, did a quick test with jsoniter, decoding the whole document (jsoniter doesn't expose
|
Use JSON decoder tokenizer to parse packages from storage indexer, and add a benchmark for the "Init" process.
The benchmark allows to compare results: slightly more allocations are needed now, but about 30% less memory is used, and it is slightly faster.
This can probably be further improved by directly applying the transformations on the parsed packages. It could be also nice to benchmark just this function and not the whole Init process, though this is the heaviest part of this process.
Before:
After: