Skip to content

Slower cursor updates in 3.6.x #284

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

Closed
baskerville opened this issue Jan 12, 2015 · 4 comments
Closed

Slower cursor updates in 3.6.x #284

baskerville opened this issue Jan 12, 2015 · 4 comments

Comments

@baskerville
Copy link

I'm experiencing a performance degradation with 3.6.x.

It seems to be caused by the following function:

function newKeyPath(head, tail) {
    return Seq(head).concat(tail).toArray();
}

If I replace it with:

function newKeyPath(head, tail) {
    return head.concat(tail);
}

performances are back to normal.

@leebyron
Copy link
Collaborator

Can you explain the performance issue further or share a benchmark?

The replacement will not work correctly if your key-paths are Iterables instead of Array, and I would like to preserve that behavior.

If you share a benchmark I can attempt to solve for the performance issue while maintaining the iterable keypath property.

@baskerville
Copy link
Author

var Immutable = require("immutable");

var a = [1, 2, 3, 5, 6, 7, 8, 9, 10],
    fns = {
        js: function (a) {
            return a.concat(a);
        },
        im: function (a) {
            return Immutable.Seq(a).concat(a).toArray();
        }
    },
    score = {};

for (var name in fns) {
    var fn = fns[name],
        before = Date.now();
    for (var i = 0; i < 3000; i++) {
        fn(a);
    }
    var delta = Date.now() - before;
    score[name] = delta;
}

console.log(score.im/score.js);

@leebyron
Copy link
Collaborator

Thanks

leebyron added a commit that referenced this issue Jan 12, 2015
leebyron added a commit that referenced this issue Jan 12, 2015
@leebyron
Copy link
Collaborator

Released as v3.6.2. Thanks for the quick report.

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