Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

arrayDiff poor performance #1

Open
lefnire opened this issue Jun 24, 2013 · 3 comments
Open

arrayDiff poor performance #1

lefnire opened this issue Jun 24, 2013 · 3 comments

Comments

@lefnire
Copy link

lefnire commented Jun 24, 2013

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

@lefnire
Copy link
Author

lefnire commented Jun 24, 2013

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?

@nateps
Copy link
Contributor

nateps commented Jun 24, 2013

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 [email protected]:

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
.

@lefnire
Copy link
Author

lefnire commented Jun 24, 2013

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants