[Java Extension] Add fast path for decoding / unescaping of ASCII-only strings#1034
Open
samyron wants to merge 2 commits into
Open
[Java Extension] Add fast path for decoding / unescaping of ASCII-only strings#1034samyron wants to merge 2 commits into
samyron wants to merge 2 commits into
Conversation
…n decoding ASCII-only strings with escape or control characters.
… being done if UTF-8 validation is disabled.
Contributor
Author
|
Note: I'm happy to remove the |
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.
Overview
This PR is a follow up to #1004. This adds a fast path when decoding / unescaping ASCII-only strings.
Additionally, this adds a new JVM system propery
jruby.json.validateUTF8Stringswhich defaults totrue. If this property is disabled, UTF-8 validation is disabled which matches the behavior of the C parser. This provides an opt-in resolution to #138 where JRuby users can explicitly disable the UTF-8 validation. If the UTF-8 validation is disabled, there is a bit of a performance benefit on some benchmarks.Benchmarks
These benchmarks were run on a M1 Macbook Air. There is a non-trivial difference between runs but I tried to get the best
beforebenchmarks possible. THeafterare a bit more stable.SWAR + UTF-8 Validation
SWAR + No UTF-8 Validation
activitypub.jsonis the same buttwitter.jsonandcitm_catalog.jsonsee improvements.Vector API + UTF-8 Validation
Vector API + No UTF-8 Validation