镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

arrayDiff poor performance #1

Description

@lefnire

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

Activity

  1. lefnire commented on Jun 24, 2013

    @lefnire
    Author

    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?

  2. nateps commented on Jun 24, 2013

    @nateps
    Contributor

    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
    .

  3. lefnire commented on Jun 24, 2013

    @lefnire
    Author

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions