-
Notifications
You must be signed in to change notification settings - Fork 915
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
A few frozen string and symbol optimizations #8177
Merged
Merged
Commits on Mar 30, 2024
-
Other flags needed to be shifted, which I was afraid of before but now I have no fear.
Configuration menu - View commit details
-
Copy full SHA for 31807bc - Browse repository at this point
Copy the full SHA 31807bcView commit details -
Configuration menu - View commit details
-
Copy full SHA for d8f1d82 - Browse repository at this point
Copy the full SHA d8f1d82View commit details
Commits on Apr 1, 2024
-
Restore original values for CR flags
These values are originally from CRuby, and now hardcoded as part of the Prism parser, so they must continue to have the same values or it will break codranges coming out of Prism. This also makes the value check a hard check rather than an assert since that will help ensure they do not accidentally get changed.
Configuration menu - View commit details
-
Copy full SHA for 44d10c6 - Browse repository at this point
Copy the full SHA 44d10c6View commit details -
Add a ByteList cache for "-256".."255"
This improves the performance of Integer#to_s for this range of values by a good 50%, based on the attached benchmark.
Configuration menu - View commit details
-
Copy full SHA for 069ac96 - Browse repository at this point
Copy the full SHA 069ac96View commit details -
Configuration menu - View commit details
-
Copy full SHA for bb5e46e - Browse repository at this point
Copy the full SHA bb5e46eView commit details -
Introduce FString to cache common conversions
An FString is a frozen string that has additionally been de- duplicated and cached. Since such strings are often later converted to symbols, integers, or floats, the FString class adds fields to lazily cache those converted values. This helps, for example, when using APIs that can take either strings or symbols but need a symbol internally; if the incoming string is an FString the symbol created from it will be cached and more readily accessible. Performance of FString conversions is many times faster with this change at the cost of all FStrings having three additional reference fields. Warming up -------------------------------------- intern normal 6.203M i/100ms intern fstring 25.811M i/100ms to_i normal 9.876M i/100ms to_i fstring 27.629M i/100ms to_f normal 14.780M i/100ms to_f fstring 27.612M i/100ms Calculating ------------------------------------- intern normal 62.499M (± 0.5%) i/s - 316.353M in 5.061824s intern fstring 274.520M (± 1.0%) i/s - 1.394B in 5.077736s to_i normal 97.868M (± 1.3%) i/s - 493.824M in 5.046716s to_i fstring 273.394M (± 1.3%) i/s - 1.381B in 5.053858s to_f normal 146.627M (± 1.2%) i/s - 739.006M in 5.040805s to_f fstring 271.105M (± 1.5%) i/s - 1.381B in 5.093658s
Configuration menu - View commit details
-
Copy full SHA for 1f12fa0 - Browse repository at this point
Copy the full SHA 1f12fa0View commit details -
Hook up to object-to-symbol paths to FString
This helps cases where an fstring (born frozen and dedup'ed) is used in a symbol API where it must be interned. For example see the benchmark and discussion in jruby#3419.
Configuration menu - View commit details
-
Copy full SHA for f701de8 - Browse repository at this point
Copy the full SHA f701de8View commit details
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.