Skip to content

Instantly share code, notes, and snippets.

@pzp1997
Created October 17, 2019 12:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pzp1997/49755cfc91af327554d5a9aa1cb65dd0 to your computer and use it in GitHub Desktop.
Save pzp1997/49755cfc91af327554d5a9aa1cb65dd0 to your computer and use it in GitHub Desktop.
// COUNTERS FOR INSTRUMENTATION
var refEqSkippedNodes, refEqSkippedDescendants;
function _VirtualDom_diff(x, y)
{
var patches = [];
refEqSkippedNodes = 0;
refEqSkippedDescendants = 0;
_VirtualDom_diffHelp(x, y, patches, 0);
console.log("skipped diff for " + refEqSkippedNodes + " nodes (REF EQ)");
console.log("skipped diff for " + refEqSkippedDescendants + " descendants (REF EQ)");
return patches;
}
function _VirtualDom_diffHelp(x, y, patches, index)
{
if (x === y)
{
refEqSkippedNodes++;
refEqSkippedDescendants += (x.__descendantsCount || 0);
return;
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment