Skip to content

Instantly share code, notes, and snippets.

@while-loop
Forked from josephwegner/benchmark
Last active Oct 20, 2016
Embed
What would you like to do?
Benchmark PhantomJS against cURL
#!/bin/bash
PREPHANTOMTIME=`date +%s%3N`
count="0"
while [ $count -lt $2 ];
do
phantomjs ./timer.js "$1" > /dev/null 2>&1
count=$[$count + 1]
done
PHANTOMFINISH=`date +%s%3N`
echo "PhantomJS Time: "
echo $[$PHANTOMFINISH - $PREPHANTOMTIME] millisecs
echo ""
preCURLTime=`date +%s%3N`
count="0"
while [ $count -lt $2 ];
do
curl $1 > /dev/null 2>&1
count=$[$count + 1]
done
CURLTIME=`date +%s%3N`
echo "CURL Time: "
echo $[$CURLTIME - preCURLTime] millisecs
var system = require('system');
if (system.args.length === 0) {
phantom.exit();
} else {
var page = require('webpage').create()
page.open(system.args[1], function () {
var body_innerHTML= page.evaluate( function() {
return document.body.innerHTML ? document.body.innerHTML : '(empty)' ;
});
//console.log(body_innerHTML);
phantom.exit();
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment