derbyjs/arraydiff

arrayDiff poor performance

Opened this issue · 3 comments

I've started replacing a lot of my old batchTxn calls with model.setDiff. It performs great if there aren't any arrays, but with a few arrays in the mix it often crashes Chrome. When I run CPU profiling around some operations, sure enough it's ~90% arrayDiff. I'll post back one I have some more useful info to provide, just thought I'd heads-up y'all early

maybe provide an option like options.replaceArrays, where it doesn't perform move / insert / remove operations on arrays it finds in an object diff, but simply replaces arrays whole-sale if they're different?

Good to know. About how many items are in these arrays? Haven't tried to
optimize arrayDiff much yet.

I can add an option to setDiff to skip array diffing relatively easily.
Also consider just using a single set or a few individual sets instead of
setDiff if you know what is going to be changing.

  • Nate

On Mon, Jun 24, 2013 at 1:18 PM, Tyler Renelle notifications@github.comwrote:

maybe an option for options.replaceArrays or some such, where it doesn't
perform move / insert / remove operations on arrays it finds in an object
diff, but simply replaces arrays whole-sale if they're different?


Reply to this email directly or view it on GitHubhttps://github.com//issues/1#issuecomment-19932804
.

The latter is my current workaround at present. I implemented a paths variable which tracks which locations are changed in Habit, for some easier optimization. You're right, and it's an easy workaround, so this ticket is pretty low-prio as a result.

About 100 item arrays methinks, one or two of them per setDiff.