Created
December 25, 2011 01:56
Simple metamorph benchmark
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
<!DOCTYPE html> | |
<title></title> | |
<div id=status></div> | |
<div id=container style=display:none></div> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> | |
<script> | |
var src = window.location.hash.substr(1), | |
script = document.createElement('script'); | |
script.src = src; | |
script.addEventListener('load', function() { | |
$('#status').html('<p>Running test for ' + src + '</p>'); | |
setTimeout(runTest, 0); | |
}); | |
document.body.appendChild(script); | |
function runTest() { | |
var start = +new Date(), | |
i = 100, j, morph; | |
while (i--) { | |
morph = Metamorph("one two three"); | |
$('#container').html(morph.outerHTML()); | |
j = 100; | |
while (j--) { | |
morph.html("three four five six"); | |
} | |
} | |
$('#status').append('<p>Completed in ' + (new Date() - start) + '</p>'); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment