Open gerich-home opened 8 years ago
Seems that the solution is to move postpone the resubscribing (https://github.com/gerich-home/it-depends/blob/master/src/computed.ts#L113) until value.write ends. However this requires redisigning notification code a bit
'computed diamond updated 1000 times with 500 hidden dependencies'
Passed:
'knockout' is etalon
'itDepends' at 2803.88x slower
2803.88x - :disappointed:
Yeah.. Working on it, has some ideas, similar in design to bulkChange.ts
Maybe I'm wrong but it seems you forgot
e.subscribe(function () {
});
for knockout setup after
var e = ko.pureComputed(function() {
return d() % 2 == 0 ? b() : c();
});
Or it was in purpose? Because you have
var s = e.onChange(function(){
});
for it-depends setup
In this case performance logs become more real:
'computed diamond updated 1000 times with 500 hidden dependencies' (passed: 2, failed: 0)
Passed:
'knockout' is etalon
'itDepends' at 56.81x slower
Finished 'performance-test-computedDiamondUpdates' after 36 s
Correct... found it independently and pushed to branch diamond-performance
See test from ee7a3537d1430bcc7e9c4eef5a430bdcf7cfb6ec
Perf results on my local machine are: