Created
August 22, 2014 06:42
-
-
Save misterdjules/acff96777e611858abc7 to your computer and use it in GitHub Desktop.
joyent/node:#8160 benchmark script
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
#!/bin/bash | |
#set -x | |
NODE=${NODE:-node} | |
NODE_DIR=$(dirname ${NODE}) | |
D8_SRC=${D8_SRC:-./deps/v8} | |
# order of source files matters | |
D8_PROFILER_JS_SRC=(./deps/v8/tools/splaytree.js \ | |
./deps/v8/tools/codemap.js \ | |
./deps/v8/tools/csvparser.js \ | |
./deps/v8/tools/consarray.js \ | |
./deps/v8/tools/profile.js \ | |
./deps/v8/tools/profile_view.js \ | |
./deps/v8/tools/logreader.js \ | |
./deps/v8/tools/tickprocessor.js \ | |
./deps/v8/tools/tickprocessor-driver.js) | |
WRK=${WRK:-wrk} | |
WRK_OPTIONS=${WRK_OPTIONS:--t12 -c400 -d10s} | |
HTTP_PORT=4242 | |
NB_RUNS=${NB_RUNS:-10} | |
read -r -d '' SIMPLE_HTTP_SERVER <<EOS | |
var http = require('http'); | |
var server = http.createServer(function (req, res) { | |
res.end(); | |
}) | |
server.listen(${HTTP_PORT}, function() { | |
}); | |
EOS | |
for TEST_RUN in $(seq 1 ${NB_RUNS}); do | |
$NODE --prof -e "${SIMPLE_HTTP_SERVER}" & | |
NODE_PID=$! | |
sleep 1; | |
$WRK ${WRK_OPTIONS} http://127.0.0.1:${HTTP_PORT}/ 2>&1 | grep Requests/sec | |
kill ${NODE_PID} | |
cat v8.log | ${D8_SRC}/out/x64.release/d8 ${D8_PROFILER_JS_SRC[*]} 2>&1 |\ | |
grep _unrefActive | |
$(rm -f v8.log) | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment