jiter icon indicating copy to clipboard operation
jiter copied to clipboard

Set up criterion and impl `std::error::Error` for error types

Open friendlymatthew opened this issue 8 months ago โ€ข 3 comments

This commit moves to criterion for its benchmarking suite. Also impls std::error::Error for jiter errors. Right now it fails to do:

use jiter::JsonValue;

// from the examples
fn main() -> Result<(), Box<dyn std::error::Error>> {
  let json_data = r#"
      {
          "name": "John Doe",
          "age": 43,
          "phones": [
              "+44 1234567",
              "+44 2345678"
          ]
      }"#;
  let json_value = JsonValue::parse(json_data.as_bytes(), true)?; // <- can't do this right now.
  println!("{:#?}", json_value);

  Ok(())
}

friendlymatthew avatar May 08 '25 12:05 friendlymatthew

PR Change Summary

Set up criterion for benchmarking and implemented std::error::Error for jiter errors.

  • Migrated to criterion for the benchmarking suite
  • Implemented std::error::Error for jiter error types
  • Added a README for benchmark instructions

Added Files

  • crates/jiter/benches/README.md

How can I customize these reviews?

Check out the Hyperlint AI Reviewer docs for more information on how to customize the review.

If you just want to ignore it on this PR, you can add the hyperlint-ignore label to the PR. Future changes won't trigger a Hyperlint review.

Note specifically for link checks, we only check the first 30 links in a file and we cache the results for several hours (for instance, if you just added a page, you might experience this). Our recommendation is to add hyperlint-ignore to the PR to ignore the link check for this PR.

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

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

codecov[bot] avatar May 08 '25 12:05 codecov[bot]

CodSpeed Performance Report

Merging #197 will create unknown performance changes

Comparing criterion (a10651b) with main (961d830)

Summary

๐Ÿ†• 70 new benchmarks
โ‰๏ธ 70 dropped benchmarks

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

Benchmarks breakdown

Benchmark BASE HEAD Change
๐Ÿ†• big_jiter_iter N/A 36.9 ms N/A
๐Ÿ†• big_jiter_skip N/A 19.2 ms N/A
๐Ÿ†• big_jiter_value N/A 49.9 ms N/A
๐Ÿ†• big_serde_value N/A 204.3 ms N/A
๐Ÿ†• bigints_array_jiter_iter N/A 125.3 ยตs N/A
๐Ÿ†• bigints_array_jiter_skip N/A 94.1 ยตs N/A
๐Ÿ†• bigints_array_jiter_value N/A 208.9 ยตs N/A
๐Ÿ†• bigints_array_serde_value N/A 719.3 ยตs N/A
๐Ÿ†• floats_array_jiter_iter N/A 184.7 ยตs N/A
๐Ÿ†• floats_array_jiter_skip N/A 106.2 ยตs N/A
๐Ÿ†• floats_array_jiter_value N/A 308.3 ยตs N/A
๐Ÿ†• floats_array_serde_value N/A 1.1 ms N/A
๐Ÿ†• massive_ints_array_jiter_iter N/A 573 ยตs N/A
๐Ÿ†• massive_ints_array_jiter_skip N/A 223.4 ยตs N/A
๐Ÿ†• massive_ints_array_jiter_value N/A 764.8 ยตs N/A
๐Ÿ†• massive_ints_array_serde_value N/A 2.2 ms N/A
๐Ÿ†• medium_response_jiter_skip N/A 16.9 ยตs N/A
๐Ÿ†• medium_response_jiter_value N/A 37.8 ยตs N/A
๐Ÿ†• medium_response_jiter_value_owned N/A 50.7 ยตs N/A
๐Ÿ†• medium_response_serde_value N/A 84.3 ยตs N/A
... ... ... ... ...

:information_source: Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.

codspeed-hq[bot] avatar May 08 '25 12:05 codspeed-hq[bot]

Looks like this introduces a dependency on half that is not MSRV compatible. It might be possible to tune things to make that not the case.

davidhewitt avatar May 19 '25 13:05 davidhewitt