pydantic / jiter

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

iterative algorithm for take_value #134

Closed davidhewitt closed 1 week ago

davidhewitt commented 1 week ago

Similar to #111, but for real work in take_value. If this adds a perf boost I can apply the same design to the Python functions too...

codecov[bot] commented 1 week ago

Codecov Report

Attention: Patch coverage is 95.18072% with 8 lines in your changes missing coverage. Please review.

Project coverage is 94.01%. Comparing base (dd25fd0) to head (08b4cd3).

Files with missing lines Patch % Lines
crates/jiter/src/value.rs 95.18% 8 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #134 +/- ## ========================================== - Coverage 94.91% 94.01% -0.91% ========================================== Files 12 12 Lines 1908 2038 +130 ========================================== + Hits 1811 1916 +105 - Misses 97 122 +25 ``` | [Files with missing lines](https://app.codecov.io/gh/pydantic/jiter/pull/134?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pydantic) | Coverage Δ | | |---|---|---| | [crates/jiter/src/lazy\_index\_map.rs](https://app.codecov.io/gh/pydantic/jiter/pull/134?src=pr&el=tree&filepath=crates%2Fjiter%2Fsrc%2Flazy_index_map.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pydantic#diff-Y3JhdGVzL2ppdGVyL3NyYy9sYXp5X2luZGV4X21hcC5ycw==) | `85.22% <ø> (-12.76%)` | :arrow_down: | | [crates/jiter/src/value.rs](https://app.codecov.io/gh/pydantic/jiter/pull/134?src=pr&el=tree&filepath=crates%2Fjiter%2Fsrc%2Fvalue.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pydantic#diff-Y3JhdGVzL2ppdGVyL3NyYy92YWx1ZS5ycw==) | `94.26% <95.18%> (-2.85%)` | :arrow_down: | ------ [Continue to review full report in Codecov by Sentry](https://app.codecov.io/gh/pydantic/jiter/pull/134?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pydantic). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pydantic) > `Δ = absolute (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://app.codecov.io/gh/pydantic/jiter/pull/134?dropdown=coverage&src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pydantic). Last update [dd25fd0...08b4cd3](https://app.codecov.io/gh/pydantic/jiter/pull/134?dropdown=coverage&src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pydantic). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pydantic).
codspeed-hq[bot] commented 1 week ago

CodSpeed Performance Report

Merging #134 will degrade performances by 10.97%

Comparing dh/iterative-take (546c4df) with main (dd25fd0)

Summary

⚡ 1 improvements ❌ 1 regressions ✅ 71 untouched benchmarks

:warning: Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark main dh/iterative-take Change
pass2_jiter_value 22.1 µs 17.1 µs +29.51%
x100_jiter_skip 1.2 µs 1.3 µs -10.97%
davidhewitt commented 1 week ago

The slowdown is probably an inlining loss in unrelated code which can be recovered by PGO. The +24% seems very real.