ADTast-experimental
Last change
on this file since 1a45263 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
|
Line | |
---|
1 | var times = 50000000 |
---|
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 | function * coroutine() { |
---|
7 | while ( true ) { |
---|
8 | yield |
---|
9 | } |
---|
10 | } |
---|
11 | cor = coroutine() |
---|
12 | |
---|
13 | for ( var i = 0; i < times; i += 1 ) { // warm JIT |
---|
14 | cor.next(); |
---|
15 | } |
---|
16 | |
---|
17 | var hrstart = process.hrtime() |
---|
18 | for ( var i = 0; i < times; i += 1 ) { |
---|
19 | cor.next(); |
---|
20 | } |
---|
21 | hrend = process.hrtime( hrstart ) |
---|
22 | var dur = (1000000000 * hrend[0] + hrend[1]) / times |
---|
23 | console.log( dur ) |
---|
24 | |
---|
25 | // Local Variables: // |
---|
26 | // tab-width: 4 // |
---|
27 | // compile-command: "nodejs node_cor.js" // |
---|
28 | // End: // |
---|
Note: See
TracBrowser
for help on using the repository browser.