Created
July 28, 2010 18:25
-
-
Save mostlygeek/495691 to your computer and use it in GitHub Desktop.
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 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> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment