ata-validator 0.4.7 → 0.4.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,12 +10,14 @@ Ultra-fast JSON Schema validator powered by [simdjson](https://github.com/simdjs
|
|
|
10
10
|
|
|
11
11
|
| Scenario | ata | ajv | |
|
|
12
12
|
|---|---|---|---|
|
|
13
|
-
| **validate(obj)** valid |
|
|
14
|
-
| **validate(obj)** invalid |
|
|
13
|
+
| **validate(obj)** valid | 76M ops/sec | 8M ops/sec | **ata 9.5x faster** |
|
|
14
|
+
| **validate(obj)** invalid | 34M ops/sec | 8M ops/sec | **ata 4.3x faster** |
|
|
15
15
|
| **isValidObject(obj)** | 15.4M ops/sec | 9.2M ops/sec | **ata 1.7x faster** |
|
|
16
16
|
| **validateJSON(str)** valid | 2.15M ops/sec | 1.88M ops/sec | **ata 1.1x faster** |
|
|
17
|
-
| **validateJSON(str)** invalid | 2.
|
|
18
|
-
| **Schema compilation** |
|
|
17
|
+
| **validateJSON(str)** invalid | 2.17M ops/sec | 2.29M ops/sec | **ata 1.1x faster** |
|
|
18
|
+
| **Schema compilation** | 113K ops/sec | 818 ops/sec | **ata 138x faster** |
|
|
19
|
+
|
|
20
|
+
> validate(obj) numbers are isolated single-schema benchmarks. Multi-schema benchmark overhead reduces throughput; real-world numbers depend on workload.
|
|
19
21
|
|
|
20
22
|
### Large Data — JS Object Validation
|
|
21
23
|
|
|
@@ -38,7 +40,7 @@ Ultra-fast JSON Schema validator powered by [simdjson](https://github.com/simdjs
|
|
|
38
40
|
|
|
39
41
|
### How it works
|
|
40
42
|
|
|
41
|
-
**
|
|
43
|
+
**Hybrid validator**: ata compiles schemas into monolithic JS functions identical to the boolean fast path, but returning `VALID_RESULT` on success and calling the error collector on failure. V8 TurboFan optimizes it identically to a pure boolean function — error code is dead code on the valid path. No try/catch (3.3x V8 deopt), no lazy arrays, no double-pass.
|
|
42
44
|
|
|
43
45
|
**JS codegen**: Schemas are compiled to monolithic JS functions (like ajv). Supported keywords: `type`, `required`, `properties`, `items`, `enum`, `const`, `allOf`, `anyOf`, `oneOf`, `not`, `if/then/else`, `uniqueItems`, `contains`, `prefixItems`, `additionalProperties`, `dependentRequired`, `$ref` (local), `minimum/maximum`, `minLength/maxLength`, `pattern`, `format`.
|
|
44
46
|
|
|
@@ -52,7 +54,7 @@ Ultra-fast JSON Schema validator powered by [simdjson](https://github.com/simdjs
|
|
|
52
54
|
|
|
53
55
|
## When to use ata
|
|
54
56
|
|
|
55
|
-
- **Any `validate(obj)` workload** —
|
|
57
|
+
- **Any `validate(obj)` workload** — 4.3x–9.5x faster than ajv
|
|
56
58
|
- **Serverless / cold starts** — 12.5x faster schema compilation
|
|
57
59
|
- **Security-sensitive apps** — RE2 regex, immune to ReDoS attacks
|
|
58
60
|
- **Batch/streaming validation** — NDJSON log processing, data pipelines (2.6x faster)
|
|
@@ -66,7 +68,7 @@ Ultra-fast JSON Schema validator powered by [simdjson](https://github.com/simdjs
|
|
|
66
68
|
|
|
67
69
|
## Features
|
|
68
70
|
|
|
69
|
-
- **
|
|
71
|
+
- **Hybrid validator**: 76M ops/sec — same function body as boolean check, returns result or calls error collector. No try/catch, no double pass
|
|
70
72
|
- **Multi-core**: Parallel validation across all CPU cores — 13.4M validations/sec
|
|
71
73
|
- **simdjson**: SIMD-accelerated JSON parsing at GB/s speeds, adaptive On Demand for large docs
|
|
72
74
|
- **RE2 regex**: Linear-time guarantees, immune to ReDoS attacks (2391x faster on pathological input)
|
|
@@ -101,7 +103,7 @@ const v = new Validator({
|
|
|
101
103
|
required: ['name', 'email']
|
|
102
104
|
});
|
|
103
105
|
|
|
104
|
-
// Fast boolean check — JS codegen (
|
|
106
|
+
// Fast boolean check — JS codegen (9.5x faster than ajv)
|
|
105
107
|
v.isValidObject({ name: 'Mert', email: 'mert@example.com', age: 26 }); // true
|
|
106
108
|
|
|
107
109
|
// Full validation with error details + defaults applied
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ata-validator",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.8",
|
|
4
4
|
"description": "Ultra-fast JSON Schema validator. Beats ajv on every valid-path benchmark: 1.1x–2.7x faster validate(obj), 151x faster compilation, 5.9x faster parallel batch. Speculative validation with V8-optimized JS codegen, simdjson, multi-core. Standard Schema V1 compatible.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|