Closed theKashey closed 5 years ago
I short, it's hard to tell which is better than others, but generally all are good.
🙅♂ current proxyShallowEqual is overall better for worst cases.
I will try to understand why my synthetic tests are so much faster than realty.
Let's extract walkTree
and redo comparison.
Basically you should expect around 5% error rate.
Results for stockticker-useReduxState
are much better
From: https://github.com/dai-shi/reactive-react-redux/issues/3#issuecomment-488847121
Trying it.
But you lost "last affected" optimization. Even without it - results looking great(same). Probably by mixing both approaches(using the old one only for memoization possibility tracking), we might achieve better results.
But you lost "last affected" optimization.
I wasn't pretty sure if it's effectively implemented. Is keeping referential equality of trie important?
...no, it's no longer needed. You are right.
Changing if (la === lb || deepDeproxify(la) === deepDeproxify(lb)) {
to if (la === lb) {
gives me better results. But it can't be helped?
I guess the stockticker benchmark is faster with proxyEqual because of collectValuables. That strikes me something: what if we cache the result of walk.
Stockticker is improved, more than 2.0.6 proxyEqual, but others are dropped.
This might require referential equality of trie, which is not implemented yet. (my naive trial was failed...)
To use trie more efficient in reporting, we may need to pass parent node (or old and new nodes) in onKeyUsage instead of suffix. This would require too much refactoring and it might not work.
Results are almost identical.
weakMemoizeWalk
improves stockticker siginificantly, but slows down twitter-lite a bit.
It's hard to compare two different versions of
shallowEqual
. I've tried 6 cases(3 x with/without memoization)Roughly - it has a simpler comparison loop, and preparation loop is also just O(n), while old sorting is more or less unpredictable.
All tests are green, but I would like to double check from you, that your tests are also green.