summaryrefslogtreecommitdiff
path: root/benchmark
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2014-08-16 21:25:52 +0100
committerPatrick Simianer <p@simianer.de>2014-08-16 21:25:52 +0100
commit9a0859212de4d1304f9392fe910921227421c8c3 (patch)
tree1b1276312c83415d7d7d3838ce0347441b71951a /benchmark
parent3ba77e3474e39d7970784812f6851a726572f7c7 (diff)
cleanup
Diffstat (limited to 'benchmark')
-rwxr-xr-xbenchmark/benchmark.rb9
-rwxr-xr-xbenchmark/run.sh41
-rwxr-xr-xbenchmark/run_msgpack.sh38
3 files changed, 88 insertions, 0 deletions
diff --git a/benchmark/benchmark.rb b/benchmark/benchmark.rb
new file mode 100755
index 0000000..81e11f8
--- /dev/null
+++ b/benchmark/benchmark.rb
@@ -0,0 +1,9 @@
+#!/usr/bin/env ruby
+
+
+ARGV[0].to_i.times {
+ start = Time.now
+ `#{ARGV[1]} #{ARGV[2]}`
+ puts Time.now-start
+}
+
diff --git a/benchmark/run.sh b/benchmark/run.sh
new file mode 100755
index 0000000..c4bf31f
--- /dev/null
+++ b/benchmark/run.sh
@@ -0,0 +1,41 @@
+#!/bin/zsh
+
+
+REPEAT=10
+TMP_OVERALL=/tmp/.overall
+
+
+echo
+echo "JSON parsing benchmark"
+echo "----------------------"
+echo " REAPEAT=$REPEAT"
+echo
+
+for prg in \
+ test_cdec_json_parser \
+ test_gason \
+ test_JsonBox \
+ test_jsoncpp \
+ test_json-cpp \
+ test_jsonxx \
+ test_libjson \
+ test_nosjob \
+ test_picojson \
+ test_rapidjson \
+ test_sajson
+do
+ echo "[$prg]"
+ sudo sync
+ sudo sh -c "echo 3 > /proc/sys/vm/drop_caches"
+ echo > $TMP_OVERALL
+ for file in `ls -S ../data/*.json`; do
+ echo "$file:\t$(./benchmark.rb $REPEAT ../src/$prg $file 2>/dev/null | tee -a $TMP_OVERALL | avg | round 2) s"
+ done
+ echo "---"
+ echo "overall:\t$(avg < $TMP_OVERALL | round 2)"
+ echo " memory:\t$(./memusg.sh ../src/$prg data/1020.json 2>/dev/null)"
+ echo
+done
+
+rm $TMP_OVERALL
+
diff --git a/benchmark/run_msgpack.sh b/benchmark/run_msgpack.sh
new file mode 100755
index 0000000..7a45df0
--- /dev/null
+++ b/benchmark/run_msgpack.sh
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+
+REPEAT=10
+TMP_OVERALL=/tmp/.overall_msgpack
+
+
+echo
+echo "MSGPACK parsing benchmark"
+echo "-------------------------"
+echo " REAPEAT=$REPEAT"
+echo
+
+for prg in \
+ test_msgpack \
+ test_msgpack_streaming \
+ test_msgpack_ruby
+do
+ echo "[$prg]"
+ sudo sync
+ sudo sh -c "echo 3 > /proc/sys/vm/drop_caches"
+ echo > $TMP_OVERALL
+ if [[ $prg == test_msgpack_streaming ]]; then
+ A="_s" # special format for streaming
+ else
+ A=""
+ fi
+ for file in `ls -S ../data/*.pak$A`; do
+ echo "$file:\t$(./benchmark.rb $REPEAT ../src/$prg $file 2>/dev/null | tee -a $TMP_OVERALL | avg | round 2) s"
+ done
+ echo "---"
+ echo "overall:\t$(avg < $TMP_OVERALL | round 2)"
+ echo " memory:\t$(./memusg.sh ../src/$prg ../data/1020.pak 2>/dev/null)"
+ echo
+done
+
+rm $TMP_OVERALL
+