Skip to content

Commit 278f105

Browse files
committed
Assume most parsing options aren't set
Same strategy used for the generator, if we assume only a couple options are passed at most, we might as well traverse the option hash rather than to check all possible keys. ``` == Parsing small hash (65 bytes) ruby 3.3.4 (2024-07-09 revision be1089c8ec) [arm64-darwin23] Warming up -------------------------------------- json 229.732k i/100ms oj 221.571k i/100ms oj strict 255.080k i/100ms Oj::Parser 427.514k i/100ms rapidjson 282.252k i/100ms Calculating ------------------------------------- json 2.185M (± 3.3%) i/s (457.68 ns/i) - 11.027M in 5.052670s oj 2.227M (± 0.4%) i/s (449.10 ns/i) - 11.300M in 5.074920s oj strict 2.532M (± 1.4%) i/s (394.97 ns/i) - 12.754M in 5.038527s Oj::Parser 4.309M (± 0.5%) i/s (232.10 ns/i) - 21.803M in 5.060621s rapidjson 2.811M (± 0.2%) i/s (355.78 ns/i) - 14.113M in 5.020940s Comparison: json: 2184913.9 i/s Oj::Parser: 4308534.8 i/s - 1.97x faster rapidjson: 2810757.1 i/s - 1.29x faster oj strict: 2531841.6 i/s - 1.16x faster oj: 2226694.4 i/s - same-ish: difference falls within error ```
1 parent f552351 commit 278f105

File tree

3 files changed

+183
-249
lines changed

3 files changed

+183
-249
lines changed

0 commit comments

Comments
 (0)