Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
non-terrible performance version suggested by @blerner
- Loading branch information
Showing
1 changed file
with
5 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1842,13 +1842,14 @@ function (Namespace, jsnums, codePoint, seedrandom, util) { | |
cache.left.push(obj1); | ||
cache.right.push(obj2); | ||
cache.equal.push(thisRuntime.ffi.equal); | ||
return cache.equal.length; | ||
} | ||
function equalHelp() { | ||
var current, curLeft, curRight; | ||
while (toCompare.stack.length > 0 && !thisRuntime.ffi.isNotEqual(toCompare.curAns)) { | ||
current = toCompare.stack.pop(); | ||
if(current.setCache) { | ||
setCachePair(current.left, current.right, toCompare.curAns); | ||
cache.equal[current.index - 1] = toCompare.curAns; | ||
This comment has been minimized.
Sorry, something went wrong. |
||
continue; | ||
} | ||
curLeft = current.left; | ||
|
@@ -1895,8 +1896,8 @@ function (Namespace, jsnums, codePoint, seedrandom, util) { | |
toCompare.curAns = curPair | ||
continue; | ||
} else { | ||
cachePair(curLeft, curRight); | ||
toCompare.stack.push({ setCache: true, left: curLeft, right: curRight }); | ||
var index = cachePair(curLeft, curRight); | ||
toCompare.stack.push({ setCache: true, index: index, left: curLeft, right: curRight }); | ||
This comment has been minimized.
Sorry, something went wrong.
blerner
Member
|
||
if (isRef(curLeft) && isRef(curRight)) { | ||
if (alwaysFlag && !(isRefFrozen(curLeft) && isRefFrozen(curRight))) { // In equal-always, non-identical refs are not equal | ||
toCompare.curAns = thisRuntime.ffi.notEqual.app(current.path, curLeft, curRight); // We would've caught identical refs already | ||
|
@@ -2058,10 +2059,9 @@ function (Namespace, jsnums, codePoint, seedrandom, util) { | |
for(var i = 0; i < toCompare.stack.length; i++) { | ||
var current = toCompare.stack[i]; | ||
if(current.setCache) { | ||
setCachePair(current.left, current.right, $ans); | ||
cache.equal[current.index - 1] = $ans; | ||
} | ||
} | ||
setCachePair(left, right, $ans); | ||
toCompare = stackOfToCompare.pop(); | ||
return $ans; | ||
} | ||
|
Could you delete the setCachePair function, too?