Skip to content
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

More efficient parsing of JSON arrays and objects #322

Conversation

plokhotnyuk
Copy link
Contributor

On JDK 17 it gives up to 2x times speed up on parsing of JSON arrays (see ArrayOfBooleansReading, ArraySeqOfBooleansReading, ListOfBooleansReading, VectorOfBooleansReading) and up to 1.3x times speed up on JSON objects (see GeoJSONReading) by the cost of slow down parsing of top-level JSON values (see Base64Reading, BigIntReading, IntReading, StringOfAsciiCharsReading, StringOfEscapedCharsReading, StringOfNonAsciiCharsReading)

Before

[info] Benchmark                                  (size)   Mode  Cnt         Score         Error  Units
[info] ADTReading.smithy4sJson                       N/A  thrpt    5   1720855.406 ±   44766.774  ops/s
[info] AnyValsReading.smithy4sJson                   N/A  thrpt    5   1930181.226 ±  115372.354  ops/s
[info] ArrayOfBigDecimalsReading.smithy4sJson        128  thrpt    5    104754.936 ±    3226.595  ops/s
[info] ArrayOfBigIntsReading.smithy4sJson            128  thrpt    5    152503.334 ±    1248.074  ops/s
[info] ArrayOfBooleansReading.smithy4sJson           128  thrpt    5    374631.192 ±    2734.387  ops/s
[info] ArrayOfBytesReading.smithy4sJson              128  thrpt    5    327909.858 ±    5943.541  ops/s
[info] ArrayOfDoublesReading.smithy4sJson            128  thrpt    5    227312.963 ±    4129.372  ops/s
[info] ArrayOfFloatsReading.smithy4sJson             128  thrpt    5    263761.424 ±   54975.976  ops/s
[info] ArrayOfInstantsReading.smithy4sJson           128  thrpt    5    120044.705 ±    5238.271  ops/s
[info] ArrayOfIntsReading.smithy4sJson               128  thrpt    5    271756.767 ±    1342.643  ops/s
[info] ArrayOfLongsReading.smithy4sJson              128  thrpt    5    289464.303 ±   20627.117  ops/s
[info] ArrayOfShortsReading.smithy4sJson             128  thrpt    5    308727.781 ±    5120.904  ops/s
[info] ArrayOfUUIDsReading.smithy4sJson              128  thrpt    5    281017.932 ±    1352.033  ops/s
[info] ArraySeqOfBooleansReading.smithy4sJson        128  thrpt    5    378938.574 ±   25856.760  ops/s
[info] Base64Reading.smithy4sJson                    128  thrpt    5   6480687.823 ±  163358.294  ops/s
[info] BigIntReading.smithy4sJson                    128  thrpt    5   6673234.533 ±  125776.839  ops/s
[info] ExtractFieldsReading.smithy4sJson             128  thrpt    5    192914.181 ±    1197.861  ops/s
[info] GeoJSONReading.smithy4sJson                   N/A  thrpt    5     22173.730 ±     941.651  ops/s
[info] GitHubActionsAPIReading.smithy4sJson          N/A  thrpt    5    345950.801 ±    1187.026  ops/s
[info] GoogleMapsAPIReading.smithy4sJson             N/A  thrpt    5     14138.772 ±      47.450  ops/s
[info] IntReading.smithy4sJson                       N/A  thrpt    5  75367705.939 ± 4254157.285  ops/s
[info] ListOfBooleansReading.smithy4sJson            128  thrpt    5    398708.500 ±   10289.973  ops/s
[info] MapOfIntsToBooleansReading.smithy4sJson       128  thrpt    5    166191.100 ±    1056.413  ops/s
[info] MissingRequiredFieldsReading.smithy4sJson     N/A  thrpt    5   9135223.274 ±   90750.144  ops/s
[info] NestedStructsReading.smithy4sJson             128  thrpt    5     90385.748 ±    4423.973  ops/s
[info] OpenRTBReading.smithy4sJson                   N/A  thrpt    5    156587.388 ±     750.255  ops/s
[info] PrimitivesReading.smithy4sJson                N/A  thrpt    5   2134434.021 ±    8514.364  ops/s
[info] SetOfIntsReading.smithy4sJson                 128  thrpt    5    190333.423 ±    4668.849  ops/s
[info] StringOfAsciiCharsReading.smithy4sJson        128  thrpt    5  15522575.896 ±  741381.817  ops/s
[info] StringOfEscapedCharsReading.smithy4sJson      128  thrpt    5   3176033.452 ±   10376.566  ops/s
[info] StringOfNonAsciiCharsReading.smithy4sJson     128  thrpt    5   3467444.118 ±   46464.133  ops/s
[info] TwitterAPIReading.smithy4sJson                N/A  thrpt    5     32727.527 ±      91.511  ops/s
[info] VectorOfBooleansReading.smithy4sJson          128  thrpt    5    406402.021 ±    2857.359  ops/s

After

[info] Benchmark                                  (size)   Mode  Cnt         Score         Error  Units
[info] ADTReading.smithy4sJson                       N/A  thrpt    5   1902588.225 ±   11068.233  ops/s
[info] AnyValsReading.smithy4sJson                   N/A  thrpt    5   2147447.971 ±   10998.383  ops/s
[info] ArrayOfBigDecimalsReading.smithy4sJson        128  thrpt    5    107981.600 ±    1969.252  ops/s
[info] ArrayOfBigIntsReading.smithy4sJson            128  thrpt    5    164448.566 ±    2523.957  ops/s
[info] ArrayOfBooleansReading.smithy4sJson           128  thrpt    5    758826.632 ±   15533.595  ops/s
[info] ArrayOfBytesReading.smithy4sJson              128  thrpt    5    555228.115 ±    6623.299  ops/s
[info] ArrayOfDoublesReading.smithy4sJson            128  thrpt    5    272482.435 ±    7072.706  ops/s
[info] ArrayOfFloatsReading.smithy4sJson             128  thrpt    5    352798.454 ±   20700.371  ops/s
[info] ArrayOfInstantsReading.smithy4sJson           128  thrpt    5    126518.384 ±    1282.320  ops/s
[info] ArrayOfIntsReading.smithy4sJson               128  thrpt    5    446488.891 ±    3054.313  ops/s
[info] ArrayOfLongsReading.smithy4sJson              128  thrpt    5    395105.035 ±    1215.560  ops/s
[info] ArrayOfShortsReading.smithy4sJson             128  thrpt    5    506658.854 ±    2379.684  ops/s
[info] ArrayOfUUIDsReading.smithy4sJson              128  thrpt    5    389755.331 ±   33971.553  ops/s
[info] ArraySeqOfBooleansReading.smithy4sJson        128  thrpt    5    791470.023 ±   19135.197  ops/s
[info] Base64Reading.smithy4sJson                    128  thrpt    5   5824134.440 ±   89041.455  ops/s
[info] BigIntReading.smithy4sJson                    128  thrpt    5   6021176.768 ±   25471.736  ops/s
[info] ExtractFieldsReading.smithy4sJson             128  thrpt    5    184229.760 ±     765.047  ops/s
[info] GeoJSONReading.smithy4sJson                   N/A  thrpt    5     29300.513 ±     475.934  ops/s
[info] GitHubActionsAPIReading.smithy4sJson          N/A  thrpt    5    371540.005 ±   31825.317  ops/s
[info] GoogleMapsAPIReading.smithy4sJson             N/A  thrpt    5     14975.683 ±      66.832  ops/s
[info] IntReading.smithy4sJson                       N/A  thrpt    5  68495278.216 ± 1379306.569  ops/s
[info] ListOfBooleansReading.smithy4sJson            128  thrpt    5    804415.545 ±    8893.539  ops/s
[info] MapOfIntsToBooleansReading.smithy4sJson       128  thrpt    5    173248.692 ±    7264.649  ops/s
[info] MissingRequiredFieldsReading.smithy4sJson     N/A  thrpt    5   9102718.098 ±   10683.069  ops/s
[info] NestedStructsReading.smithy4sJson             128  thrpt    5     92464.670 ±     610.700  ops/s
[info] OpenRTBReading.smithy4sJson                   N/A  thrpt    5    172682.863 ±    3258.562  ops/s
[info] PrimitivesReading.smithy4sJson                N/A  thrpt    5   2389648.503 ±  111842.564  ops/s
[info] SetOfIntsReading.smithy4sJson                 128  thrpt    5    214105.143 ±    1314.110  ops/s
[info] StringOfAsciiCharsReading.smithy4sJson        128  thrpt    5  12046724.407 ±  142157.992  ops/s
[info] StringOfEscapedCharsReading.smithy4sJson      128  thrpt    5   3052402.650 ±  105154.344  ops/s
[info] StringOfNonAsciiCharsReading.smithy4sJson     128  thrpt    5   3261442.880 ±  128143.471  ops/s
[info] TwitterAPIReading.smithy4sJson                N/A  thrpt    5     35793.444 ±     163.018  ops/s
[info] VectorOfBooleansReading.smithy4sJson          128  thrpt    5    924836.727 ±    8931.597  ops/s

Copy link
Contributor

@Baccata Baccata left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for that 😄 !

@Baccata Baccata merged commit 75f4242 into disneystreaming:main Jul 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants