File tree 1 file changed +33
-11
lines changed 1 file changed +33
-11
lines changed Original file line number Diff line number Diff line change 1
- #! /bin/sh
1
+ #! /bin/bash
2
2
set -e
3
3
4
+ # Prepend text to a file in-place.
5
+ function di::prepend_text {
6
+ local file=$1
7
+ local text=$2
8
+
9
+ # NOTE: sed -i doesn't work on osx/bsd
10
+ tmpfile=$( mktemp -t di_benchmark.XXXXXX)
11
+ echo " $text " > $tmpfile
12
+ cat " $file " >> $tmpfile
13
+ cp -f " $tmpfile " " $file "
14
+ rm -f " $tmpfile "
15
+ }
16
+
4
17
BENCHMARKS=" module_benchmark.dart
5
18
dynamic_injector_benchmark.dart
6
19
static_injector_benchmark.dart
@@ -11,21 +24,30 @@ mkdir -p benchmark/generated_files
11
24
dart scripts/class_gen.dart
12
25
13
26
# run tests in dart
14
- for b in $BENCHMARKS
15
- do
16
- dart benchmark/$b
27
+ echo " Dart VM Benchmarks:"
28
+ echo " -------------------"
29
+ for b in $BENCHMARKS ; do
30
+ echo " Running: $b "
31
+ dart benchmark/$b
17
32
done
18
33
19
34
# run dart2js on tests
35
+ echo
36
+ echo " Compiling with dart2js:"
37
+ echo " -----------------------"
20
38
mkdir -p out
21
- echo " running dart2js"
22
- for b in $BENCHMARKS
23
- do
24
- dart2js --minify benchmark/$b -o out/$b .js > /dev/null
39
+ for b in $BENCHMARKS ; do
40
+ echo " $b "
41
+ dart2js --minify benchmark/$b -o out/$b .js > /dev/null
42
+ # HACK node.js doesn't understand self
43
+ di::prepend_text " out/$b .js" " var self=this"
25
44
done
26
45
27
46
# run tests in node
28
- for b in $BENCHMARKS
29
- do
30
- node out/$b .js
47
+ echo
48
+ echo " JS Benchmarks:"
49
+ echo " --------------"
50
+ for b in $BENCHMARKS ; do
51
+ echo " Running: $b "
52
+ node out/$b .js
31
53
done
You can’t perform that action at this time.
0 commit comments