mattphillips / deep-object-diff

Deep diffs two objects, including nested structures of arrays and objects, and returns the difference. ❄️
https://www.npmjs.com/package/deep-object-diff
MIT License
1.05k stars 89 forks source link

Usage of reduce spread #46

Closed schester44 closed 2 years ago

schester44 commented 5 years ago

There could be noticeable perf improvements if we were to stop using the reduce spread pattern in the diffing methods.

Some benchmarks from changing the diff method to use basic for loops:

original x 377,694 ops/sec ±0.62% (86 runs sampled) new x 788,699 ops/sec ±0.55% (91 runs sampled)

Reference: https://www.richsnapp.com/blog/2019/06-09-reduce-spread-anti-pattern

I have most of the work done in a fork. Would you be open to a PR?

anko commented 5 years ago

I assume you mean https://github.com/schester44/deep-object-diff/commit/7caf8a1dd8990a343753e389d3b3a9accad16558. I like it. I think you should PR!

Comments so far:

schester44 commented 5 years ago

I'll go ahead and continue with this and create PR soon.

mattphillips commented 2 years ago

Closing as I've merged #64 and published in v1.1.7