Skip to content

JSON builder optimizations#2363

Merged
FranciscoThiesen merged 3 commits intojson_builder_initfrom
json_builder_init_optimizations
Apr 14, 2025
Merged

JSON builder optimizations#2363
FranciscoThiesen merged 3 commits intojson_builder_initfrom
json_builder_init_optimizations

Conversation

@lemire
Copy link
Member

@lemire lemire commented Apr 13, 2025

These a tiny optimizations on top of json_builder_init. On one system and one benchmark, it reduces the number of instructions by about 7% and it improves the speed by about 5%.

Before:

$ ./buildreflect/benchmark/static_reflect/twitter_benchmark/benchmark_serialization_twitter
bench_simdjson_static_reflection                             :  1848.61 MB/s   0.42 Ms/s   3.19 GHz   1.73 c/b   5.40 i/b   3.13 i/c

After:

$ ./buildreflect/benchmark/static_reflect/twitter_benchmark/benchmark_serialization_twitter
bench_simdjson_static_reflection                             :  1945.19 MB/s   0.44 Ms/s   3.19 GHz   1.64 c/b   5.04 i/b   3.07 i/c

@lemire lemire requested a review from FranciscoThiesen April 13, 2025 21:34
@FranciscoThiesen
Copy link
Member

These are the results I got on my machine with your changes, pretty significant!

Before:
Screenshot 2025-04-13 at 23 38 56

After:
Screenshot 2025-04-13 at 23 35 51

@FranciscoThiesen
Copy link
Member

What a beautiful PR. Would never have guessed the look-up tables could be faster than such a tiny number of comparisons..

The results I got on my machine in terms of total time are even more significant than the ones you reported... 2.1GB/s -> 3.0GB/s.

@FranciscoThiesen FranciscoThiesen merged commit 29bba62 into json_builder_init Apr 14, 2025
139 checks passed
@FranciscoThiesen FranciscoThiesen deleted the json_builder_init_optimizations branch April 14, 2025 06:46
@CarlosEduR
Copy link
Member

Really nice!

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.

3 participants