ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change
on this file since 7ac3151 was
7ac3151,
checked in by Peter A. Buhr <pabuhr@…>, 5 years ago
|
add nodejs await experiment to benchmarks
|
-
Property mode set to
100644
|
File size:
591 bytes
|
Line | |
---|
1 | var times = 1000000 |
---|
2 | var argc = process.argv.length // node, path |
---|
3 | if ( argc > 3 ) process.exit( 1 ) |
---|
4 | if ( argc == 3 ) times = Number( process.argv[2] ) |
---|
5 | |
---|
6 | var p = new Promise( |
---|
7 | function( rs ) { |
---|
8 | resolve = rs; |
---|
9 | } |
---|
10 | ); |
---|
11 | |
---|
12 | for ( var i = 0; i < times; i += 1 ) { |
---|
13 | p = p.then( |
---|
14 | () => { return } |
---|
15 | ); |
---|
16 | } |
---|
17 | |
---|
18 | p = p.then( |
---|
19 | () => { |
---|
20 | hrend = process.hrtime( hrstart ) |
---|
21 | var dur = (1000000000 * hrend[0] + hrend[1]) / times |
---|
22 | console.log( dur ) |
---|
23 | } |
---|
24 | ); |
---|
25 | |
---|
26 | var hrstart = process.hrtime() |
---|
27 | resolve(); |
---|
28 | |
---|
29 | // Local Variables: // |
---|
30 | // tab-width: 4 // |
---|
31 | // compile-command: "nodejs node_await.js" // |
---|
32 | // End: // |
---|
Note: See
TracBrowser
for help on using the repository browser.