Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Slightly speed up the contains keyword.
Saves some unnecessary repeated validator re-creation while validating arrays. In a quick benchmark (added here) and on my local machine (an M2 Mini) this goes from: ``` baseline: Mean +- std dev: 3.55 us +- 0.04 us beginning: Mean +- std dev: 3.37 ms +- 0.02 ms middle: Mean +- std dev: 3.37 ms +- 0.03 ms end: Mean +- std dev: 3.36 ms +- 0.02 ms invalid: Mean +- std dev: 3.40 ms +- 0.02 ms ``` to: ``` baseline: Mean +- std dev: 4.27 us +- 0.05 us beginning: Mean +- std dev: 2.65 ms +- 0.01 ms middle: Mean +- std dev: 2.66 ms +- 0.02 ms end: Mean +- std dev: 2.67 ms +- 0.02 ms invalid: Mean +- std dev: 2.70 ms +- 0.02 ms ``` on the included example (synthetic of course, but not ridiculously so). (The lack of difference in timing for how far into the array we get before finding a match seems interesting but probably requires a benchmark with a more interesting subschema we're matching on).
- Loading branch information