Skip to content

Performance: Enable fast parsing/writing for double #7822

@mgodwan

Description

@mgodwan

Is your feature request related to a problem? Please describe.
The default behaviour of jackson is to use JDK provided Double#parseDouble methods to convert string to double data types. Jackson also provides a fast parser for string to double conversion which can be leveraged to speed up the parsing process.
We should explore enabling the same and see if it may be beneficial to us in general, esp. for cases where we may deal with a lot of double data types such as vectors.

Describe the solution you'd like

  • Enable Jackson Features USE_FAST_DOUBLE_PARSER and USE_FAST_DOUBLE_WRITER
  • If this provides advantage, as next steps we can explore to replace usage of double parsing in OpenSearch code as well at multiple places.

Additional context
I ran a quick micro-benchmark after enabling the features for JsonParser in Jackson which yielded the following results:

Setup: MacBook Pro (13-inch, M1, 2020), 16G RAM

Doubles in range 0.0 - 1.0

Benchmark Mode Cnt Score Error Units
DocumentParsingBenchmark.doParseDoubleWithFastDoubleParser avgt 10 30.276 ? 4.795 ns/op
DocumentParsingBenchmark.doParseDoubleWithJdkParser avgt 10 106.918 ? 5.233 ns/op

Doubles in range -1E9 to +1E9

Benchmark Mode Cnt Score Error Units
DocumentParsingBenchmark.doParseDoubleWithFastDoubleParser avgt 15 32.087 ? 2.897 ns/op
DocumentParsingBenchmark.doParseDoubleWithJdkParser avgt 15 134.490 ? 25.577 ns/op

Metadata

Metadata

Assignees

No one assigned

    Labels

    Indexing & SearchPerformanceThis is for any performance related enhancements or bugsenhancementEnhancement or improvement to existing feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions