source: benchmark/ctxswitch/node_cor.js @ 065de93

Last change on this file since 065de93 was 3c64c668, checked in by Peter A. Buhr <pabuhr@…>, 4 years ago

warm JIT for node.js benchmarks

  • Property mode set to 100644
File size: 583 bytes
RevLine 
[b4107c8]1var times = 50000000
2var argc = process.argv.length // node, path
3if ( argc > 3 ) process.exit( 1 )
4if ( argc == 3 ) times = Number( process.argv[2] )
5
6function * coroutine() {
7        while ( true ) {
8                yield
9        }
10}
11cor = coroutine()
12
[3c64c668]13for ( var i = 0; i < times; i += 1 ) { // warm JIT
14        cor.next();
15}
16
[b4107c8]17var hrstart = process.hrtime()
18for ( var i = 0; i < times; i += 1 ) {
19        cor.next();
20}
21hrend = process.hrtime( hrstart )
22var dur = (1000000000 * hrend[0] + hrend[1]) / times
23console.log( dur )
24
25// Local Variables: //
26// tab-width: 4 //
[c12869e]27// compile-command: "nodejs node_cor.js" //
[b4107c8]28// End: //
Note: See TracBrowser for help on using the repository browser.