Add SimpleStreamReader#2318
Merged
Merged
Conversation
Replaces uses of InputStreamReader with a simplified version, where we recycle the underlying byte buffer, vs creating a new 8k buffer on every parse. Gives a good performance improvements for all but the largest inputs, where the allocation cost is amortized across a longer parse.
Owner
Author
|
Benchmark results of before and after. These parse from an InputStream; that's the path impacted by this change. We use this for HTTP and File inputs. |
Owner
Author
|
Here's a chart of the impact. The specific ops/s change is quite dependent on active memory pressure. Interesting to see that the small size shows little impact relative to the others. Not sure if that's a measurement anomaly of the test or if there's further ground to be made particularly around that size. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Continuing on the work in #2186 to reuse large buffers to minimize allocations (and therefore GC) during parsing, this change allows us to reuse the byte -> char decoding buffer.
Replaces uses of InputStreamReader with a simplified version, where we recycle the underlying byte buffer, vs creating a new 8k buffer on every parse.
Gives a good performance improvements for all but the largest inputs, where the allocation cost is amortized across a longer parse.