source: benchmark/ctxswitch/node_await.js@ 7ac3151

ADT arm-eh ast-experimental enum forall-pointer-decay jacob/cs343-translation jenkins-sandbox new-ast new-ast-unique-expr pthread-emulation qualifiedEnum
Last change on this file since 7ac3151 was 7ac3151, checked in by Peter A. Buhr <pabuhr@…>, 6 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.