Use string interning for fun and performance#1054
Closed
simonthum wants to merge 1 commit intoaaubry:masterfrom
Closed
Use string interning for fun and performance#1054simonthum wants to merge 1 commit intoaaubry:masterfrom
simonthum wants to merge 1 commit intoaaubry:masterfrom
Conversation
This cuts about 20% of parsing cost and probably more in final object graph size, depending on input data. In terms of the LoadLarge benchmark: | Method | Mean | Error | StdDev | Gen0 | Gen1 | Gen2 | Allocated | |-----------------:|---------:|--------:|---------:|----------:|----------:|----------:|----------:| | LoadLarge before | 136.9 ms | 3.11 ms | 9.03 ms | 7500.0000 | 3500.0000 | 1500.0000 | 39.65 MB | | LoadLarge after | 114.4 ms | 3.70 ms | 10.67 ms | 6000.0000 | 2000.0000 | 1000.0000 | 39.65 MB | This is just a simple string.Intern call. It might make sense to emplyor pass a pool, like a XmlNameTable does with XML, to save on scalar objects not just strings.
Author
|
The build failure seems unrelated to the changes. |
Collaborator
|
It's because your branch name is master. If you use a branch not named master we can work on getting this merged in. |
Author
|
I opened another PR to change the branch. |
Author
|
See #1055 |
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.
This cuts about 20% of parsing cost and probably more in final object graph size, depending on input data.
In terms of the LoadLarge benchmark:
This is just a simple string.Intern call. It might make sense to employ or pass a pool, like a XmlNameTable does with XML, to save on scalar objects not just strings.
As for my motivation, yaml parsing dominates a startup time I care about. This seems like an easy fix.