|
|
|
|
|
by kosinus
1682 days ago
|
|
I maintain symmetry[1] and wanted to try the benchmark against it, but the results are very inconsistent. Symmetry is anywhere between 50% slower to 20% _faster_ than microdiff on the small object benchmark. Symmetry doesn't get a lot of activity, but I've been using it in production for many years. It does some more work on array diffing, which this benchmark doesn't cover, by implementing part of Myers' algorithm. [1]: https://github.com/Two-Screen/symmetry/ |
|
I added three more libraries, and also the size in bytes of `JSON.stringify(result)` for each. (That was also important for me in making symmetry.)
The results from benchmark.js are a lot more consistent on my laptop:
Benchmark: Small object (baseline)
- @n1ru4l/json-patch-plus x 1,426,241 ops/sec ±0.29% (94 runs sampled) (94 bytes)
- deep-diff x 337,122 ops/sec ±0.45% (95 runs sampled) (193 bytes)
- deep-object-diff x 2,138,118 ops/sec ±0.25% (96 runs sampled) (60 bytes)
- diff x 59,277 ops/sec ±0.60% (97 runs sampled) (268 bytes)
- jsondiffpatch x 841,880 ops/sec ±0.38% (96 runs sampled) (113 bytes)
- microdiff x 6,979,471 ops/sec ±0.77% (95 runs sampled) (171 bytes)
- symmetry x 8,666,619 ops/sec ±0.21% (97 runs sampled) (7 bytes)
Benchmark: Large Object (300 properties)
- @n1ru4l/json-patch-plus x 16,902 ops/sec ±0.66% (92 runs sampled) (515 bytes)
- deep-diff x 8,378 ops/sec ±0.68% (96 runs sampled) (1194 bytes)
- deep-object-diff x 19,647 ops/sec ±0.40% (94 runs sampled) (410 bytes)
- diff x 737 ops/sec ±0.45% (94 runs sampled) (12051 bytes)
- jsondiffpatch x 14,306 ops/sec ±0.76% (95 runs sampled) (714 bytes)
- microdiff x 22,131 ops/sec ±0.25% (95 runs sampled) (935 bytes)
- symmetry x 21,432 ops/sec ±0.92% (98 runs sampled) (424 bytes)