Merge branch 'benchmarks'
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by visionmedia · committed by visionmedia · parents b5df39b, 59c4e35 · Browse files · 10 files·+85 added−37 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
10 files+85 added−37 removed
- other:+85 added−37 removed
Provenance
- Commit
e2fe603- Tree
23a0663- Author
visionmedia <tj@vision-media.ca>- Committer
visionmedia <tj@vision-media.ca>- Parent 1
b5df39b- Parent 2
59c4e35
10 files changed+85 added−37 removed
modified:benchmarks/thin/simple.ru+4 added-4 removed
1 2 require 'rubygems'3-require 'rack'3+require 'sinatra'4 5-app = lambda do |env|6- [200, { 'Content-Type' => 'text/plain' }, 'Hello World']5+get '/' do6+ 'Hello World'7 end8 9-run app9+run Sinatra::Applicationdeleted:benchmarks/thin/simple.sinatra.ru-9 removed
1-2-require 'rubygems'3-require 'sinatra'4-5-get '/' do6- 'Hello World'7-end8-9-run Sinatra::Applicationadded:benchmarks/thin/static.large.ru+9 added
1+2+require 'rubygems'3+require 'sinatra'4+5+get '/' do6+ send_file 'benchmarks/shared/huge.js'7+end8+9+run Sinatra::Applicationadded:benchmarks/thin/static.ru+9 added
1+2+require 'rubygems'3+require 'sinatra'4+5+get '/' do6+ send_file 'benchmarks/shared/jquery.js'7+end8+9+run Sinatra::Applicationdeleted:benchmarks/thin/static.sinatra.large.ru-9 removed
1-2-require 'rubygems'3-require 'sinatra'4-5-get '/' do6- send_file 'benchmarks/shared/huge.js'7-end8-9-run Sinatra::Applicationdeleted:benchmarks/thin/static.sinatra.ru-9 removed
1-2-require 'rubygems'3-require 'sinatra'4-5-get '/' do6- send_file 'benchmarks/shared/jquery.js'7-end8-9-run Sinatra::Applicationadded:benchmarks/graph+35 added
1+#!/usr/bin/env bash2+3+#4+# Output gnuplot script.5+# 6+# <title> <node> <express> <sinatra>7+#8+9+function plot() {10+ cat <<-EOF11+set terminal png12+set output "benchmarks/graphs/$1.png"13+set title "$1"14+set size 1,0.715+set grid y16+set key left top17+set xlabel "request percentage"18+set xlabel "response time (ms)"19+plot "benchmarks/$2" using 10 with lines title "node", \\20+ "benchmarks/$3" using 10 with lines title "express", \\21+ "benchmarks/$4" using 10 with lines title "sinatra thin"22+EOF23+}24+25+mkdir -p benchmarks/graphs26+27+for type in simple static static.large; do28+ echo ... generating benchmarks/graphs/$type.png29+ plot $type \30+ express/$type.js.plot \31+ node/$type.js.plot \32+ thin/$type.ru.plot \33+ > benchmarks/graphs/$type.p34+ gnuplot benchmarks/graphs/$type.p35+donemodified:benchmarks/run+20 added-4 removed
3 unmodified lines4 ABFLAGS=${ABFLAGS-"-n 2000 -c 50"}5 ADDR=${ADDR-http://127.0.0.1:3000/}6 AB=${AB-ab}7 8+#9+# Log <msg ...>10+# 11+# <msg ...>12+#13+14 log(){15 echo "... $@"16 }17 18+#19+# Benchmark <type> and <file>20+# 21+# - starts the server22+# - allows $SLEEP seconds for startup23+# - runs $AB24+# - kills the server process25+# 26+# <type> <file>27+#28+29 bm(){30 local type=$131 local file=$232 log benchmarking $type $file6 unmodified lines39 ;;40 esac41 pid=$!42 sleep $SLEEP26- $AB $ABFLAGS -e benchmarks/$type/$file.csv $ADDR > benchmarks/$type/$file.out43+ $AB $ABFLAGS -g benchmarks/$type/$file.plot $ADDR > benchmarks/$type/$file.out44 log $(cat benchmarks/$type/$file.out | grep Requests)45 kill -KILL $pid46 }47 4 unmodified lines52 bm express simple.js53 bm express static.js54 bm express static.large.js55 bm thin simple.ru39-bm thin simple.sinatra.ru40-bm thin static.sinatra.ru41-bm thin static.sinatra.large.ru56+bm thin static.ru57+bm thin static.large.rumodified:.gitignore+3 added-1 removed
1 .DS_Store2 *.seed3 *.log4 *.csv5-*.out5+*.plot6+*.out7+benchmarks/graphsmodified:Makefile+5 added-1 removed
33 unmodified lines34 @$(COFFEE) examples/coffee-upload/app.coffee35 36 benchmark: benchmarks/run37 @./benchmarks/run38+ @./benchmarks/graph39 40+graphs:41+ @./benchmarks/graph42+39-.PHONY: install test app43+.PHONY: install test app benchmark graphs