Last active
August 30, 2016 23:53
-
-
Save jmas/c7c11f1431bf97f0333d6da639b0c0cd to your computer and use it in GitHub Desktop.
DOM diff libraries test
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
// Uncomment only when you use it in test: | |
// import * as diffhtml from 'diffhtml'; | |
// import morphdom from 'morphdom'; | |
// You need a document with <div id="root"></div> | |
var rootEl = document.getElementById('root'); | |
// Replace with big real HTML pice. | |
var tpl = `<div>Replace with real big HTML pice.</div>`; | |
console.profile("diffhtml.innerHTML()"); | |
var start = window.performance.now(); | |
for (var i=0,ln=1000; i<ln; i++) { | |
// You can uncomment one of 3 following tests: | |
// Test 1. Native innerHTML | |
// rootEl.innerHTML = tpl//tpl.replace(/\{rnd\}/ig, fn); | |
// Test 2. diffhtml.innerHTML | |
// diffhtml.innerHTML(rootEl, tpl); | |
// Test 3. morphdom | |
// morphdom(rootEl, tpl); | |
} | |
console.profileEnd(); | |
console.log(window.performance.now() - start); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment