flitbit / diff

Javascript utility for calculating deep difference, capturing changes, and applying changes across objects; for nodejs and the browser.
MIT License
2.99k stars 213 forks source link

Performance #84

Open endel opened 7 years ago

endel commented 7 years ago

This is not really an issue. Just a room for improvement.

I did a performance comparisson between deep-diff and fast-json-patch diff algorithms, and fast-json-patch is way faster. Would be nice to improve performance of this project.

Results:

fast-json-patch x 178,872 ops/sec ±2.08% (76 runs sampled)
deep-diff x 14,368 ops/sec ±2.39% (76 runs sampled)

Source code: https://gist.github.com/endel/d9d498f50419d6108a07433122b15719

flitbit commented 7 years ago

I've done the same with similar results, my own use cases don't require optimization so I've never done so; but clearly there is a lot of recursion and looping going on. Reducing the call stack would go a long way. I'd welcome some pull requests if anybody feels up to the challenge.