pydantic / jiter

Fast iterable JSON parser.
https://crates.io/crates/jiter
MIT License
182 stars 11 forks source link

convert skip to iterate instead of call recursive functions #111

Closed davidhewitt closed 3 months ago

davidhewitt commented 3 months ago

The observation is that "skip" functionality shouldn't be hard to avoid function recursion because the return type is always (). So here's an attempted implementation. Should hopefully be faster...

codspeed-hq[bot] commented 3 months ago

CodSpeed Performance Report

Merging #111 will improve performances by 66.7%

Comparing dh/iter-skip (aa6b268) with main (366d16a)

Summary

⚡ 4 improvements ✅ 69 untouched benchmarks

Benchmarks breakdown

Benchmark main dh/iter-skip Change
big_jiter_skip 19.6 ms 17.5 ms +11.87%
pass2_jiter_skip 3.5 µs 2.1 µs +66.7%
short_numbers_jiter_skip 61 µs 55.1 µs +10.7%
x100_jiter_skip 1.3 µs 1.2 µs +10.11%
codecov[bot] commented 3 months ago

Codecov Report

Attention: Patch coverage is 89.47368% with 6 lines in your changes are missing coverage. Please review. Files Patch % Lines
crates/jiter/src/value.rs 89.47% 6 Missing :warning:

:loudspeaker: Thoughts on this report? Let us know!

samuelcolvin commented 3 months ago

This is great, thank you.