Skip to content

Instantly share code, notes, and snippets.

@tpai
Last active June 17, 2019 15:46
Show Gist options
  • Save tpai/4c85df830819a85af214 to your computer and use it in GitHub Desktop.
Save tpai/4c85df830819a85af214 to your computer and use it in GitHub Desktop.
jquery cdn speed race
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>jQuery CDN Speed Race by jQuery async ajax</title>
</head>
<body>
<center><h1>jQuery CDN Speed Race by jQuery async ajax</h1></center>
<h2>Test Subjects</h2>
<pre id="list"></pre>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/async/0.9.0/async.js"></script>
<script type="text/javascript">
var libs = [
"http://code.jquery.com/jquery-2.1.1.min.js",
"http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js",
"http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js",
"http://libs.useso.com/js/jquery/2.1.1/jquery.min.js",
"http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"
]
async.eachSeries(libs, function(lib, callback) {
var start = window.performance.now()
$.ajax({
url: lib,
dataType: "script",
success: function() {
var end = window.performance.now()
$("#list").append("* ("+(end-start).toFixed(2)+"ms) <a href='"+lib+"' target='_blank'>"+lib+"</a>\n")
callback()
}
})
})
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>jQuery CDN Speed Race at Chrome DevTools</title>
</head>
<body>
<center><h1>jQuery CDN Speed Race at Chrome DevTools</h1></center>
<h2>Test Subjects</h2>
<pre>
* <a href="http://zh-tw.cdnjs.com/">cdnjs</a>
* <a href="https://developers.google.com/speed/libraries/devguide">google cdn</a>
* <a href="https://code.jquery.com/jquery-2.1.1.min.js">jquery official website</a>
* <a href="http://libs.useso.com/js.php">360 cdn</a>
* <a href="http://cdn.code.baidu.com/">baidu cdn</a>
</pre>
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="http://libs.useso.com/js/jquery/2.1.1/jquery.min.js"></script>
<script src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment