-
-
Notifications
You must be signed in to change notification settings - Fork 812
Measure performance improvement by "fast double parsing" #970
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
Comments
Preliminary results suggests similar performance characteristics between Jackson 2.14 and 2.15(.0-rc2):
this is bit disappointing -- although there may be data for which benefit would be larger (arrays of floating-point values; bigger magnitude and/or longer fractional parts?). |
Would it be possible to have separate JMH tests of ReaderBasedJsonParser.nextFieldName() and of DoubleParser.deserialize()? When I look at the test runs of JsonStringReadVanilla.readCurrencyPojoFast() in VisualVM, I see that half of the time is spent in each method. Because, when I just measure FastDoubleParser on Java 8 and on Java 17, I see the same performance speedup on both JVMs. com.fasterxml.jackson.databind.deser.std.MapDeserializer._readAndBindStringKeyMap() 93.3% |
@wrandelshofer Ah. one quick note: please dis-regard Still, that should not cause major issues. Method in question is for matching key (JSON Object) for On one hand it'd be good to also have more FP-heavy data (arrays). On the other hand it's sort of impressive how reading of FP values is relatively not that much heavier than String decoding. |
And yes, it'd be good to have more targeted test(s). I was hoping to use something close to "real world" to give users some idea (I have half-written blog about this case). But there are definitely different uses for tests too, including verifying specific low-level decoding performance. |
The benchmark results of I tried with the "CompactString"-Feature disabled/enabled and with/without an Inline-Hint for the JIT.
|
@wrandelshofer that is odd indeed. |
Closing since I have created the benchmark & published preliminary results via: https://cowtowncoder.medium.com/jackson-2-15-yet-faster-floating-point-reads-fd6d5a0b769a so future work can be under different GH issues. |
It might be worth testing with the java command line flag in https://github.com/wrandelshofer/FastDoubleParser#performance-tuning A further set of optimisations that could be consider include not using Strings to cache numbers in the JsonParser implementations and use char arrays instead. FastDoubleParser supports parsing char arrays. When using JDK number parsing, we would need to create Strings then (because JDK number parsing generally doesn't support parsing char arrays). One thing to watch out for is that jackson-core recycles char arrays so when we cache numbers as char arrays, we will need to clone the array first. This char array caching might speed up fast parsing path but at the risk of slowing down the main path. See one reason that Strings may be a bit of a problem: |
Right. In most cases we can share a reference to number decoded in But there is also the real problem of having to defer some parsing; for example, pretty much all Kotlin/Scala usage is via Object types that use Constructor; this requires buffering, and buffering with I am not 100% sure how much overhead |
Looking at profiler output, it does look like about 33% of time is spent in decoding (from String to double), and another 15% decoding JSON number token itself. But that 33% seems to be spent both on Unfortunately looking at handling of As to command-line flag I am not sure: unless users use same settings, not sure there's point in improving benchmark numbers themselves; it seems most valuable to see kinds of numbers users are likely to see. |
Jackson 2.14 added
StreamReadFeature.USE_FAST_DOUBLE_PARSER
and backing implementation to speed up decoding of floating-point values from JSON (see #577). But we haven't published results (or actually done much in way of measurements).Let's change that.
The text was updated successfully, but these errors were encountered: