forked from dart-archive/di.dart
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run-benchmarks.sh
executable file
·53 lines (46 loc) · 1.06 KB
/
run-benchmarks.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
set -e
# Prepend text to a file in-place.
function di::prepend_text {
local file=$1
local text=$2
# NOTE: sed -i doesn't work on osx/bsd
tmpfile=$(mktemp -t di_benchmark.XXXXXX)
echo "$text" > $tmpfile
cat "$file" >> $tmpfile
cp -f "$tmpfile" "$file"
rm -f "$tmpfile"
}
BENCHMARKS="module_benchmark.dart
dynamic_injector_benchmark.dart
static_injector_benchmark.dart
instance_benchmark.dart
large_benchmark.dart"
mkdir -p benchmark/generated_files
dart scripts/class_gen.dart
# run tests in dart
echo "Dart VM Benchmarks:"
echo "-------------------"
for b in $BENCHMARKS; do
echo "Running: $b"
dart benchmark/$b
done
# run dart2js on tests
echo
echo "Compiling with dart2js:"
echo "-----------------------"
mkdir -p out
for b in $BENCHMARKS; do
echo "$b"
dart2js --minify benchmark/$b -o out/$b.js > /dev/null
# HACK node.js doesn't understand self
di::prepend_text "out/$b.js" "var self=this"
done
# run tests in node
echo
echo "JS Benchmarks:"
echo "--------------"
for b in $BENCHMARKS; do
echo "Running: $b"
node out/$b.js
done