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

Per scenario performance comparison tests #64

Open
gerich-home opened this issue Apr 5, 2016 · 0 comments
Open

Per scenario performance comparison tests #64

gerich-home opened this issue Apr 5, 2016 · 0 comments

Comments

@gerich-home
Copy link
Owner

There should be an ability to compare performance of certain scenarios (not versus KnockoutJS)
For example I know at least 2 tests I want to write that way.

  • Example 1

Given the following definitions:

var x = [];
for (var j = 0; j < dependenciesCount; j++) {
    x.push(itDepends.value(-1));
}

var a = itDepends.computed(function() {
    var z = 0;
    for (var j = 0; j < dependenciesCount; j++) {
        z += x[j]();
    }
    return z;
});

var b = itDepends.value(true);

var c = itDepends.computed(function() {
    return b() ? a() : 0;
});

the scenario:

itDepends.bulkChange(function() {
    c.onChange(function() {});
    b.write(false);
});

should work faster than scenario with approximately the same performance as in the following scenario (see #68):

c.onChange(function() {});
b.write(false);
  • Example 2

Given the following definitions:

var x = [];
for (var j = 0; j < dependenciesCount; j++) {
    x.push(itDepends.value(-1));
}

var a = itDepends.computed(function() {
    var z = 0;
    for (var j = 0; j < dependenciesCount; j++) {
        z += x[j]();
    }
    return z;
});

var b = itDepends.value(6);
var c = itDepends.value(10);

var d = itDepends.computed(function() {
    return b() * c() === 60 ? a() : 0;
});

var s = d.onChange(function() {});

the scenario:

itDepends.bulkChange(function() {
    b.write(4);
    c.write(15);
});

should work faster than scenario:

b.write(4);
c.write(15);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant