~cyphermox/cordova-cli/flatten

« back to all changes in this revision

Viewing changes to node_modules/cordova/node_modules/xcode/node_modules/node-uuid/benchmark/bench.sh

  • Committer: Mathieu Trudel-Lapierre
  • Date: 2013-12-12 05:26:53 UTC
  • Revision ID: mathieu-tl@ubuntu.com-20131212052653-eatjt8zguqua5qmq
testing the flattenage, yo

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/bash
2
 
 
3
 
# for a given node version run:
4
 
# for i in {0..9}; do node benchmark.js >> bench_0.6.2.log; done;
5
 
 
6
 
PATTERNS=('nodeuuid.v1()' "nodeuuid.v1('binary'," 'nodeuuid.v4()' "nodeuuid.v4('binary'," "uuid()" "uuid('binary')" 'uuidjs.create(1)' 'uuidjs.create(4)' '140byte')
7
 
FILES=(node_uuid_v1_string node_uuid_v1_buf node_uuid_v4_string node_uuid_v4_buf libuuid_v4_string libuuid_v4_binary uuidjs_v1_string uuidjs_v4_string 140byte_es)
8
 
INDICES=(2 3 2 3 2 2 2 2 2)
9
 
VERSIONS=$( ls bench_*.log | sed -e 's/^bench_\([0-9\.]*\)\.log/\1/' | tr "\\n" " " )
10
 
TMPJOIN="tmp_join"
11
 
OUTPUT="bench_results.txt"
12
 
 
13
 
for I in ${!FILES[*]}; do
14
 
  F=${FILES[$I]}
15
 
  P=${PATTERNS[$I]}
16
 
  INDEX=${INDICES[$I]}
17
 
  echo "version $F" > $F
18
 
  for V in $VERSIONS; do
19
 
    (VAL=$( grep "$P" bench_$V.log | LC_ALL=en_US awk '{ sum += $'$INDEX' } END { print sum/NR }' ); echo $V $VAL) >> $F
20
 
  done
21
 
  if [ $I == 0 ]; then
22
 
    cat $F > $TMPJOIN
23
 
  else
24
 
    join $TMPJOIN $F > $OUTPUT
25
 
    cp $OUTPUT $TMPJOIN
26
 
  fi
27
 
  rm $F
28
 
done
29
 
 
30
 
rm $TMPJOIN
31
 
 
32
 
gnuplot bench.gnu
33
 
convert -density 200 -resize 800x560 -flatten bench.eps bench.png
34
 
rm bench.eps