Skip to content

Commit 6bee238

Browse files
authored
chore: update benchmark results (#63)
Co-authored-by: sberan <100066+sberan@users.noreply.github.com>
1 parent b2b4aed commit 6bee238

File tree

11 files changed

+13019
-12942
lines changed

11 files changed

+13019
-12942
lines changed

BENCHMARKS.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ Head-to-head performance comparison (tjs vs each validator). Only test groups wh
88

99
| Validator | Compliance | ops/s | vs tjs |
1010
|-----------|----------:|------:|-------:|
11-
| [tjs](https://github.com/sberan/tjs) | 100% | 20.7M | - |
12-
| [ajv](https://ajv.js.org/) | 95% | 8.9M | 2.3x slower |
13-
| [zod](https://zod.dev/) | 59% | 167K | 124.1x slower |
14-
| [joi](https://joi.dev/) | 58% | 439K | 47.2x slower |
15-
| [is-my-json-valid](https://www.npmjs.com/package/is-my-json-valid) | 81% | 18.0M | 1.2x slower |
16-
| [z-schema](https://github.com/zaggino/z-schema) | 52% | 791K | 26.2x slower |
17-
| [djv](https://github.com/korzio/djv) | 76% | 4.1M | 5.1x slower |
18-
| [jsen](https://github.com/bugventure/jsen) | 76% | 16.5M | 1.3x slower |
19-
| [@exodus/schemasafe](https://github.com/ExodusMovement/schemasafe) | 90% | 18.9M | 1.1x slower |
11+
| [tjs](https://github.com/sberan/tjs) | 100% | 20.4M | - |
12+
| [ajv](https://ajv.js.org/) | 95% | 8.9M | 🟢 2.3x slower |
13+
| [zod](https://zod.dev/) | 59% | 167K | 🟢 121.7x slower |
14+
| [joi](https://joi.dev/) | 58% | 433K | 🟢 47.0x slower |
15+
| [is-my-json-valid](https://www.npmjs.com/package/is-my-json-valid) | 81% | 17.9M | 🟢 1.1x slower |
16+
| [z-schema](https://github.com/zaggino/z-schema) | 52% | 823K | 🟢 24.8x slower |
17+
| [djv](https://github.com/korzio/djv) | 76% | 4.1M | 🟢 5.0x slower |
18+
| [jsen](https://github.com/bugventure/jsen) | 76% | 16.9M | 🟢 1.2x slower |
19+
| [@exodus/schemasafe](https://github.com/ExodusMovement/schemasafe) | 90% | 19.1M | 🟢 1.1x slower |
2020

2121
## Performance Chart
2222

@@ -41,11 +41,11 @@ Average nanoseconds per test for each JSON Schema draft version (lower is better
4141

4242
| Draft | tjs | ajv | zod | joi | is-my-json-valid | z-schema | djv | jsen | schemasafe |
4343
|-------|----:|----:|----:|----:|----:|----:|----:|----:|----:|
44-
| draft4 | 38 | 77 | 6950 | 2927 | 65 | 1197 | 288 | 66 | 47 |
45-
| draft6 | 34 | 69 | 6775 | 2299 | 59 | - | 277 | 64 | 43 |
46-
| draft7 | 63 | 75 | 5935 | 2065 | 54 | - | 250 | 58 | 47 |
47-
| draft2019-09 | 51 | 152 | 5477 | 2151 | 50 | 1933 | 217 | 60 | 53 |
48-
| draft2020-12 | 48 | 147 | 5349 | 2103 | 54 | 1476 | 215 | 55 | 67 |
44+
| draft4 | 37 | 75 | 6925 | 2350 | 67 | 1178 | 289 | 66 | 46 |
45+
| draft6 | 35 | 68 | 6928 | 2278 | 60 | - | 274 | 63 | 43 |
46+
| draft7 | 63 | 78 | 5936 | 2390 | 53 | - | 248 | 58 | 47 |
47+
| draft2019-09 | 52 | 151 | 5527 | 2064 | 51 | 1480 | 216 | 55 | 52 |
48+
| draft2020-12 | 50 | 146 | 5149 | 2483 | 50 | 1437 | 216 | 56 | 66 |
4949

5050
## Methodology
5151

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
![Benchmark](assets/benchmark.svg)
1818

19-
100% spec compliance. 51% faster than ajv. Zero dependencies. Full TypeScript inference.
19+
100% spec compliance. 50% faster than ajv. Zero dependencies. Full TypeScript inference.
2020

2121

2222
## At a Glance
@@ -81,20 +81,20 @@ See [COMPLIANCE.md](COMPLIANCE.md) for details.
8181
### Blazing Fast
8282

8383
See [BENCHMARKS.md](BENCHMARKS.md) for detailed performance comparison.
84-
tjs uses JIT compilation to generate optimized validation code — **51% faster than ajv** overall:
84+
tjs uses JIT compilation to generate optimized validation code — **50% faster than ajv** overall:
8585

8686
```
8787
Performance vs ajv (JSON Schema Test Suite):
8888
--------------------------------------------------------------------------------
8989
Draft Files Tests | tjs ns/test ajv ns/test Diff
9090
--------------------------------------------------------------------------------
91-
draft-04 43 881 | 38 77 -51%
92-
draft-06 52 1170 | 34 69 -51%
93-
draft-07 63 1534 | 63 75 -17%
94-
draft-2019-09 77 1941 | 51 152 -67%
95-
draft-2020-12 80 1990 | 48 147 -67%
91+
draft-04 43 881 | 37 75 -51%
92+
draft-06 52 1170 | 35 68 -49%
93+
draft-07 63 1534 | 63 78 -20%
94+
draft-2019-09 77 1941 | 52 151 -66%
95+
draft-2020-12 80 1990 | 50 146 -66%
9696
--------------------------------------------------------------------------------
97-
TOTAL 315 7516 | 48 99 -51%
97+
TOTAL 315 7516 | 49 98 -50%
9898
--------------------------------------------------------------------------------
9999
```
100100

assets/benchmark.svg

Lines changed: 98 additions & 21 deletions
Loading

0 commit comments

Comments
 (0)