# allof-merge benchmark Node v26.13.0, Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz, darwin. Generated by `pnpm start` in benchmark/ (benchmark/index.ts). | Library | Version | How it is called | |---|---|---| | allof-merge 1.0 (this branch) | 1.0.0 (this repository) | deep merge, local $refs (also circular), OpenAPI / AsyncAPI / GraphApi rule sets, issues reported | | allof-merge 0.6.8 (released) | 0.6.8 | the current npm release (latest dist-tag): deep merge, local $refs, OpenAPI / GraphApi rule sets | | @redocly/allof-merge | 0.6.13 | Redocly's fork of allof-merge 0.6 | | json-schema-merge-allof | 0.8.1 | deep merge, no $ref resolution (dereference first), throws on incompatible values | | @stoplight/json-schema-merge-allof | 0.8.0 | Stoplight's fork of json-schema-merge-allof | | @x0k/json-schema-merge | 1.1.1 | createDeepAllOfMerge with the documented comparator / deduplicator; draft-07 only, no $ref resolution | | @fastify/merge-json-schemas | 0.2.2 | mergeSchemas([...]) applied bottom-up to every allOf node (the library merges a list, not a tree); throws on conflicts and on differing values of keywords it has no resolver for (pattern, format, …) | ## Speed Milliseconds per merge, min (median); a fresh copy of the input per run, not timed. `n/a`: the library does not resolve `$ref`, `throws`: the library throws on the input. Schema workloads are also checked with the oracle: ✗ the result is not equivalent to the input, ◐ equivalent but `allOf` is left (parts without an exact merged form are kept). Document workloads (OpenAPI / JSON Schema documents with `$ref`) are not checked. | Workload | allof-merge 1.0 (this branch) | allof-merge 0.6.8 (released) | @redocly/allof-merge | json-schema-merge-allof | @stoplight/json-schema-merge-allof | @x0k/json-schema-merge | @fastify/merge-json-schemas | |---|---:|---:|---:|---:|---:|---:|---:| | data.json | 0.65 (1.00) ◐ | 1.66 (1.91) | 1.10 (1.31) | 3.79 (4.36) | 2.88 (3.34) | throws | throws | | wide-2000 | 31.5 (40.1) | 146 (152) | 87.5 (90.4) | 207 (212) | 161 (167) | 15.5 (17.4) | 5.52 (6.93) | | deep-200 | 2.85 (3.40) | 85.7 (89.9) | 14.9 (15.7) | 8869 (8887) | 502 (520) | 3.66 (3.87) | 0.41 (0.42) | | combinators-100 | 5.83 (7.30) ◐ | 36.4 (38.3) | 21.6 (22.7) | 60.3 (63.2) | 52.8 (55.3) | 4.11 (4.30) | 1.05 (1.11) | | js-allof-200 | 3.65 (4.26) | 17.9 (19.4) | 13.6 (14.6) | n/a | n/a | n/a | n/a | | github-rest | 99.9 (112) | 1462 (1489) | 559 (584) | n/a | n/a | n/a | n/a | | corpus-586 | 8.97 (11.7) | 78.5 (79.7) | 82.6 (85.4) | 37.0 (38.6) | 28.6 (30.8) | 8.58 (9.13) | 38.5 (40.2) | - `data.json`: the repository's benchmark schema: 56 allOf over most keywords (6.5 KB) - `wide-2000`: 2 000 properties, each an allOf of two object fragments - `deep-200`: 200 levels of allOf nested through properties - `combinators-100`: 100 allOf of three oneOf / anyOf groups (24 branches each) - `js-allof-200`: JSON Schema with 200 definitions of allOf [$ref Base, $ref Mixin, own properties] (600 $refs, 42 KB) - `github-rest`: GitHub REST API description (OpenAPI 3.0, c9c95fe, ~12 MB, allOf with $ref) - `corpus-586`: every corpus case without `$ref` that every library merges without throwing, merged one after the other ## Correctness Every case of the fuzz corpus (`test/fuzz/corpus`: real-world cases collected from the test suites and issue trackers of these and other libraries, probes, allof-merge fuzz regressions) without allof-merge-specific options. A result is **equivalent** when it gives every generated instance the same verdict as the input (@cfworker/json-schema, the oracle of the test suite), **allOf-free** when it is equivalent and holds no `allOf`; a **mismatch** accepts (lax) or rejects (strict) an instance the input does not. Cases whose input the oracle cannot load are skipped. The corpus was used to develop allof-merge 1.0, so read its numbers as a regression check rather than an unbiased comparison; the `real-world` rows are the fairest. ### Without $ref | Library | Cases | Equivalent | allOf-free | Mismatch (lax / strict) | Throws | Invalid output | Timeout | |---|---:|---:|---:|---:|---:|---:|---:| | allof-merge 1.0 (this branch) | 968 | 960 (99.2 %) | 724 (74.8 %) | 8 (0 / 8, 8 by the format rule) | 0 | 0 | 0 | | allof-merge 0.6.8 (released) | 968 | 764 (78.9 %) | 759 (78.4 %) | 163 (108 / 59) | 7 | 34 | 0 | | @redocly/allof-merge | 968 | 783 (80.9 %) | 778 (80.4 %) | 174 (116 / 63) | 2 | 9 | 0 | | json-schema-merge-allof | 968 | 704 (72.7 %) | 698 (72.1 %) | 92 (45 / 47) | 170 | 0 | 2 | | @stoplight/json-schema-merge-allof | 968 | 620 (64.0 %) | 614 (63.4 %) | 93 (47 / 46) | 253 | 0 | 2 | | @x0k/json-schema-merge | 968 | 879 (90.8 %) | 707 (73.0 %) | 36 (30 / 6) | 51 | 0 | 2 | | @fastify/merge-json-schemas | 968 | 665 (68.7 %) | 665 (68.7 %) | 81 (67 / 14) | 220 | 0 | 2 | Equivalent per source / profile: | Subset | allof-merge 1.0 (this branch) | allof-merge 0.6.8 (released) | @redocly/allof-merge | json-schema-merge-allof | @stoplight/json-schema-merge-allof | @x0k/json-schema-merge | @fastify/merge-json-schemas | |---|---:|---:|---:|---:|---:|---:|---:| | 2020-12 | 159/159 | 127/159 | 130/159 | 112/159 | 79/159 | 139/159 | 132/159 | | draft-07 | 801/809 | 637/809 | 653/809 | 592/809 | 541/809 | 740/809 | 533/809 | | fuzz-history | 250/250 | 219/250 | 223/250 | 193/250 | 119/250 | 243/250 | 218/250 | | probes | 170/170 | 95/170 | 101/170 | 92/170 | 88/170 | 129/170 | 95/170 | | real-world | 540/548 | 450/548 | 459/548 | 419/548 | 413/548 | 507/548 | 352/548 | ### With $ref | Library | Cases | Equivalent | allOf-free | Mismatch (lax / strict) | Throws | Invalid output | Timeout | |---|---:|---:|---:|---:|---:|---:|---:| | allof-merge 1.0 (this branch) | 218 | 218 (100.0 %) | 201 (92.2 %) | 0 (0 / 0) | 0 | 0 | 0 | | allof-merge 0.6.8 (released) | 218 | 180 (82.6 %) | 175 (80.3 %) | 30 (19 / 11) | 1 | 7 | 0 | | @redocly/allof-merge | 218 | 187 (85.8 %) | 182 (83.5 %) | 24 (13 / 12) | 1 | 6 | 0 | | json-schema-merge-allof | 218 | 205 (94.0 %) | 162 (74.3 %) | 11 (10 / 1) | 1 | 1 | 0 | | @stoplight/json-schema-merge-allof | 218 | 179 (82.1 %) | 137 (62.8 %) | 34 (33 / 1) | 1 | 4 | 0 | | @x0k/json-schema-merge | 218 | 204 (93.6 %) | 200 (91.7 %) | 11 (11 / 0) | 2 | 1 | 0 | | @fastify/merge-json-schemas | 218 | 188 (86.2 %) | 188 (86.2 %) | 0 (0 / 0) | 29 | 1 | 0 | Equivalent per source / profile: | Subset | allof-merge 1.0 (this branch) | allof-merge 0.6.8 (released) | @redocly/allof-merge | json-schema-merge-allof | @stoplight/json-schema-merge-allof | @x0k/json-schema-merge | @fastify/merge-json-schemas | |---|---:|---:|---:|---:|---:|---:|---:| | 2020-12 | 143/143 | 117/143 | 124/143 | 140/143 | 116/143 | 138/143 | 130/143 | | draft-07 | 75/75 | 63/75 | 63/75 | 65/75 | 63/75 | 66/75 | 58/75 | | probes | 22/22 | 17/22 | 18/22 | 15/22 | 14/22 | 15/22 | 13/22 | | real-world | 196/196 | 163/196 | 169/196 | 190/196 | 165/196 | 189/196 | 175/196 | ## Caveats - The oracle compares verdicts on generated instances (boundary values, enum members, pattern samples, property names of the schemas); a difference no generated instance exposes is not seen. Example: for `allOf: [{ properties: { foo, foo123 }, patternProperties: { "^bar": {} }, additionalProperties: false }, { properties: { bar, bar123 }, patternProperties: { ".+\\d+$": {} }, additionalProperties: false }]` json-schema-merge-allof returns `{ additionalProperties: false, properties: { foo123, bar, bar123 } }`, which rejects `barX9` (allowed by both items); it counts as equivalent here. allof-merge keeps the two shapes and reports `object-shape-kept`. - `throws` includes libraries reporting a contradiction by throwing (json-schema-merge-allof, @x0k/json-schema-merge, @fastify/merge-json-schemas throw on incompatible `type`s); allof-merge writes `false` and reports an `unsatisfiable` issue instead. - Libraries that do not resolve `$ref` are run on the `$ref` cases as they are (no dereferencing): a `$ref` inside `allOf` stays a part, which is equivalent but not allOf-free. - allof-merge's non-equivalent results are its decided format rule: two different `format`s make the schema `false`, which rejects non-string instances the input accepts. - Each library runs the corpus in a child process with a 10 s per-case timeout; speed is measured in one process, one library after the other, with a fresh copy of the input per run.