Palindrom / JSONPatcherProxy

ES6 proxy powered JSON Object observer that emits JSON patches when changes occur to your object tree.
94 stars 14 forks source link

Nice things (test refactor) from PR 39 #42

Closed warpech closed 5 years ago

warpech commented 5 years ago

PR #39 contains discussable changes that downgrade performance, but also refactoring of the test suite.

Since I don't want to merge performance degradation until absolutely required, I decided to make another PR with things that are easier to agree with.

In fact, these changes were already agreed, because PR #39 got a green light for merging. Just in case, @tomalec please give a quick review again. Changes are only in package.json and tests.

Changes are explained in the commit messages, but here's a short summary:

I think this can be merged to master before PRs #39 and #41, then I can open new rebased PRs for #39 and #41 (this won't take long).

Benchmark formatting before this PR:

jsonpatcherproxy generate operation
 Ops/sec: 144269 ±2.90% Ran 9277 times in 0.064 seconds.
jsonpatch generate operation
 Ops/sec: 97748 ±7.24% Ran 6095 times in 0.062 seconds.
jsonpatcherproxy mutation - huge object
 Ops/sec: 790 ±3.76% Ran 50 times in 0.063 seconds.
jsonpatch mutation - huge object
 Ops/sec: 761 ±2.86% Ran 45 times in 0.059 seconds.
jsonpatcherproxy generate operation - huge object
 Ops/sec: 708 ±4.18% Ran 46 times in 0.065 seconds.
jsonpatch generate operation - huge object
 Ops/sec: 851 ±1.40% Ran 47 times in 0.055 seconds.
PROXIFY big object
 Ops/sec: 1805 ±2.05% Ran 104 times in 0.058 seconds.
DIRTY-OBSERVE big object
 Ops/sec: 1697 ±1.17% Ran 93 times in 0.055 seconds.

Benchmark formatting after this PR:

Observe and generate, small object (noop)
 Ops/sec: 12434413 ±0.39% Ran 637179 times in 0.051 seconds.
Observe and generate, small object (JSONPatcherProxy)
 Ops/sec: 95511 ±2.74% Ran 5983 times in 0.063 seconds.
Observe and generate, small object (fast-json-patch)
 Ops/sec: 68608 ±1.63% Ran 3780 times in 0.055 seconds.
Observe and generate (noop)
 Ops/sec: 164602 ±0.30% Ran 8453 times in 0.051 seconds.
Observe and generate (JSONPatcherProxy)
 Ops/sec: 1893 ±1.92% Ran 204 times in 0.108 seconds.
Observe and generate (fast-json-patch)
 Ops/sec: 1650 ±0.98% Ran 95 times in 0.058 seconds.
Primitive mutation (noop)
 Ops/sec: 2601631 ±0.32% Ran 132729 times in 0.051 seconds.
Primitive mutation (JSONPatcherProxy)
 Ops/sec: 524799 ±0.19% Ran 26797 times in 0.051 seconds.
Primitive mutation (fast-json-patch)
 Ops/sec: 7955 ±0.36% Ran 409 times in 0.051 seconds.
Complex mutation (noop)
 Ops/sec: 6382115 ±0.23% Ran 325296 times in 0.051 seconds.
Complex mutation (JSONPatcherProxy)
 Ops/sec: 8731 ±0.30% Ran 448 times in 0.051 seconds.
Complex mutation (fast-json-patch)
 Ops/sec: 8281 ±0.26% Ran 424 times in 0.051 seconds.
Serialization (noop)
 Ops/sec: 7036 ±0.38% Ran 365 times in 0.052 seconds.
Serialization (JSONPatcherProxy)
 Ops/sec: 1278 ±0.34% Ran 66 times in 0.052 seconds.
Serialization (fast-json-patch)
 Ops/sec: 7092 ±0.49% Ran 365 times in 0.051 seconds.