Created
July 28, 2010 18:25
-
-
Save mostlygeek/495691 to your computer and use it in GitHub Desktop.
Revisions
-
mostlygeek created this gist
Jul 28, 2010 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ <!DOCTYPE html5> <html> <head> <meta charset="utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <title>Testing of Components</title> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script> $(function() { // benchmark async fetching of 10 files for (var i=0; i < 10; i++) { // required to do it this way otherwise closures don't work // correctly. (function(i) { var start = new Date().getTime(); $.get('data.txt', function(data) { var time = (new Date().getTime()) - start; $('#output').append("Run: " + i + " took " + time + "ms <br/>"); }); })(i); // tada! } }); </script> </head> <body id="output"> </body> </html>