source: benchmark/ctxswitch/node_await.js @ 8a13c47

ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since 8a13c47 was 7ac3151, checked in by Peter A. Buhr <pabuhr@…>, 4 years ago

add nodejs await experiment to benchmarks

  • Property mode set to 100644
File size: 591 bytes
Line 
1var times = 1000000
2var argc = process.argv.length // node, path
3if ( argc > 3 ) process.exit( 1 )
4if ( argc == 3 ) times = Number( process.argv[2] )
5
6var p = new Promise(
7    function( rs ) {
8                resolve = rs;
9    }
10);
11
12for ( var i = 0; i < times; i += 1 ) {
13    p = p.then(
14                () => { return }
15    );
16}
17
18p = p.then(
19    () => {
20                hrend = process.hrtime( hrstart )
21                var dur = (1000000000 * hrend[0] + hrend[1]) / times
22                console.log( dur )
23    }
24);
25
26var hrstart = process.hrtime()
27resolve();
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.