Skip to content

Conversation

@jatin-bhateja
Copy link
Contributor

Benchmark performs fast table lookup to match following JSON structural code points to accelerate JSON parsing scheme described in [1] using two vector selectFrom API[2] added in JDK-24[3]
, -> 0x2c
: -> 0x3a
[ -> 0x5b
] -> 0x5d
{ -> 0x7b
} -> 0x7d
tab, line feed, carriage return -> 0x9, 0xa, 0xd
space -> 0x20

Following are the perfromance numbers on Ryzen 7 7840HS - AVX512 system.

Benchmark                                     (size)   Mode  Cnt      Score   Error   Units
FastJSONCodePointMatchBenchmark.match_avx2      1024  thrpt    2   3383.359          ops/ms
FastJSONCodePointMatchBenchmark.match_avx512    1024  thrpt    2  60911.407          ops/ms
FastJSONCodePointMatchBenchmark.match_scalar    1024  thrpt    2   1445.365          ops/ms

[1] Parsing Gigabytes of JSON per Second : https://arxiv.org/abs/1902.08318
[2] Vector.selectFrom
[3] JEP 489: Vector API (Ninth Incubator): https://openjdk.org/jeps/489

* - JEP 489: Vector API (Ninth Incubator): https://openjdk.org/jeps/489
* - Parsing Gigabytes of JSON per Second : https://arxiv.org/abs/1902.08318
*/
@BenchmarkMode(Mode.Throughput)
Copy link
Owner

@ionutbalosin ionutbalosin Aug 3, 2025

Choose a reason for hiding this comment

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

Could you please use @BenchmarkMode(Mode.AverageTime)?

The main reason is that after all the benchmarks run, I have some additional logic that calculates the geometric mean, which relies on AverageTime and keeps it consistent across all benchmarks.

E.g., https://github.com/ionutbalosin/jvm-performance-benchmarks/blob/main/scripts/ggplot2/geomean-utils.r#L69

Copy link
Contributor Author

@jatin-bhateja jatin-bhateja Aug 3, 2025

Choose a reason for hiding this comment

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

Done

Benchmark                                     (size)  Mode  Cnt    Score   Error  Units
FastJSONCodePointMatchBenchmark.match_avx2      1024  avgt    2  303.377          ns/op
FastJSONCodePointMatchBenchmark.match_avx512    1024  avgt    2   15.549          ns/op
FastJSONCodePointMatchBenchmark.match_scalar    1024  avgt    2  694.167          ns/op

@jatin-bhateja
Copy link
Contributor Author

Thanks @chriswhocodes and @ionutbalosin , kindly merge this PR.

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.

4 participants