File tree 3 files changed +24
-9
lines changed 3 files changed +24
-9
lines changed Original file line number Diff line number Diff line change @@ -31,17 +31,17 @@ Benchmark
31
31
32
32
*** Environment:***
33
33
- MacBook Pro (Retina, 15-inch, Late 2013)
34
- - macOS 10.14
35
- - node.js v10.11 .0
36
- - rustc 1.31 .0-nightly (4bd4e4130 2018-10-25 )
34
+ - macOS 10.14.3
35
+ - node.js v11.9 .0
36
+ - rustc 1.33 .0-nightly (ceb251214 2019-01-16 )
37
37
38
38
*** Results:***
39
39
40
40
| Target | Time, *** ms*** | Size, *** KB*** |
41
41
| -------------------------| -----------------| ----------------|
42
- | ** AssemblyScript WASM** | ** 3167 ** | ** 2** |
43
- | AssemblyScript ASMJS | 3633 | 21 * |
44
- | JavaScript | 2628 | 5* |
45
- | Rust WASM | 3876 | 13 |
42
+ | ** AssemblyScript WASM** | ** 2901 ** | ** 2** |
43
+ | AssemblyScript ASMJS | 3720 | 19 * |
44
+ | JavaScript | 2716 | 5* |
45
+ | Rust WASM | 2883 | 13 |
46
46
47
47
___ * unminified___
Original file line number Diff line number Diff line change 10
10
"tsbuild" : " tsc -p assembly -t ES2017 -m commonjs --outDir build" ,
11
11
"build" : " npm run asbuild && npm run tsbuild" ,
12
12
"server" : " http-server . -o -c-1" ,
13
- "test" : " node tests"
13
+ "test" : " node --noliftoff --nowasm-tier-up --wasm-lazy-compilation --wasm-no-bounds-checks --expose-gc tests"
14
14
},
15
15
"devDependencies" : {
16
16
"http-server" : " ^0.11.1" ,
Original file line number Diff line number Diff line change @@ -34,11 +34,25 @@ const nbodyJS = new Function(
34
34
...Object . keys ( scopeJS ) . concat ( src + "\nreturn exports" ) ) ( ...Object . values ( scopeJS )
35
35
) ;
36
36
37
+ function gcCollect ( ) {
38
+ if ( global . gc ) {
39
+ global . gc ( ) ;
40
+ global . gc ( ) ;
41
+ }
42
+ }
43
+
44
+ function sleep ( delay ) {
45
+ var start = Date . now ( ) ;
46
+ while ( Date . now ( ) < start + delay ) ;
47
+ }
48
+
37
49
function test ( nbody , steps ) {
38
50
nbody . init ( ) ;
39
51
var start = process . hrtime ( ) ;
40
52
nbody . bench ( steps ) ;
41
- return process . hrtime ( start ) ;
53
+ let t = process . hrtime ( start ) ;
54
+ gcCollect ( ) ;
55
+ return t ;
42
56
}
43
57
44
58
var steps = process . argv . length > 2 ? parseInt ( process . argv [ 2 ] , 10 ) : 20000000 ;
@@ -66,6 +80,7 @@ prologue("Rust WASM", steps);
66
80
epilogue ( test ( nbodyRS , steps ) ) ;
67
81
68
82
console . log ( "\nWARMED UP SERIES:\n" ) ;
83
+ sleep ( 1000 ) ;
69
84
70
85
prologue ( "AssemblyScript WASM" , steps ) ;
71
86
epilogue ( test ( nbodyAS , steps ) ) ;
You can’t perform that action at this time.
0 commit comments