Skip to content

Instantly share code, notes, and snippets.

@garex
Last active August 29, 2015 14:26
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 garex/b01a776adaabd77cff75 to your computer and use it in GitHub Desktop.
Save garex/b01a776adaabd77cff75 to your computer and use it in GitHub Desktop.
innerHTML speed test code
var bodyHtml = document.body.innerHTML;
function a() {
var date = Date.now();
document.body.innerHTML = Math.random().toString() + 'test';
console.log('render ' + (Date.now() - date) + 'ms');
setTimeout(a, 0);
}
function b() {
var date = Date.now();
document.body.innerHTML = bodyHtml;
console.log('render ' + (Date.now() - date) + 'ms');
setTimeout(b, 0);
}
a();
b();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment