Created
June 10, 2012 17:11
-
-
Save n1k0/2906650 to your computer and use it in GitHub Desktop.
Silly benchmarks
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
var casper = require("casper").create(); | |
var start = new Date().getTime(); | |
var links = [ | |
"http://google.com/", | |
"http://yahoo.com/", | |
"http://bing.com/" | |
]; | |
casper.start(); | |
casper.each(links, function(self, link) { | |
this.thenOpen(link, function() { | |
var now = new Date().getTime(); | |
this.echo(link + ' loaded in ' + (now - start) + 'ms'); | |
start = now; | |
}); | |
}); | |
casper.run(); |
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
http://google.com/ loaded in 3643ms | |
http://yahoo.com/ loaded in 12398ms | |
http://bing.com/ loaded in 1005ms |
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
var links = [ | |
"http://google.com/", | |
"http://yahoo.com/", | |
"http://bing.com/" | |
]; | |
var start = new Date().getTime(); | |
var page = require('webpage').create(); | |
page.open("http://google.com/", function() { | |
var now = new Date().getTime(); | |
console.log('loaded google in ' + (now - start) + 'ms'); | |
start = now; | |
page.open("http://yahoo.com/", function() { | |
var now = new Date().getTime(); | |
console.log('loaded yahoo in ' + (now - start) + 'ms'); | |
start = now; | |
page.open("http://bing.com/", function() { | |
var now = new Date().getTime(); | |
console.log('loaded bing in ' + (now - start) + 'ms'); | |
start = now; | |
phantom.exit(); | |
}); | |
}); | |
}); |
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
loaded google in 4568ms | |
loaded yahoo in 10839ms | |
loaded bing in 1849ms |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
casperjs ❯ casperjs --disk-cache=yes casper_speed.js
http://google.com/ loaded in 1196ms
http://yahoo.com/ loaded in 3492ms
http://bing.com/ loaded in 1362ms
casperjs ❯ casperjs --disk-cache=yes casper_speed.js
http://google.com/ loaded in 659ms
http://yahoo.com/ loaded in 2451ms
http://bing.com/ loaded in 911ms
casperjs ❯ casperjs --disk-cache=yes casper_speed.js
http://google.com/ loaded in 656ms
http://yahoo.com/ loaded in 2489ms
http://bing.com/ loaded in 751ms
casperjs ❯ casperjs --disk-cache=yes casper_speed.js
http://google.com/ loaded in 656ms
http://yahoo.com/ loaded in 2571ms
http://bing.com/ loaded in 730ms