Skip to content

Instantly share code, notes, and snippets.

@nateps
Created December 25, 2011 01:56
Show Gist options
  • Select an option

  • Save nateps/1518620 to your computer and use it in GitHub Desktop.

Select an option

Save nateps/1518620 to your computer and use it in GitHub Desktop.

Revisions

  1. nateps created this gist Dec 25, 2011.
    32 changes: 32 additions & 0 deletions metamorph-bench.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,32 @@
    <!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>