Skip to content

Instantly share code, notes, and snippets.

@nateps
Created December 25, 2011 01:56
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 nateps/1518620 to your computer and use it in GitHub Desktop.
Save nateps/1518620 to your computer and use it in GitHub Desktop.
Simple metamorph benchmark
<!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