ADT
        ast-experimental
        enum
        forall-pointer-decay
        pthread-emulation
        qualifiedEnum
      
      
        
          | Last change
 on this file since 65502d8 was             3c64c668, checked in by Peter A. Buhr <pabuhr@…>, 5 years ago | 
        
          | 
warm JIT for node.js benchmarks
 | 
        
          | 
              
Property                 mode
 set to                 100644 | 
        
          | File size:
            554 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() { yield } | 
|---|
| 7 |  | 
|---|
| 8 | for ( var i = 0; i < times; i += 1 ) { // warm JIT | 
|---|
| 9 | cor = coroutine() | 
|---|
| 10 | } | 
|---|
| 11 |  | 
|---|
| 12 | var hrstart = process.hrtime() | 
|---|
| 13 | for ( var i = 0; i < times; i += 1 ) { | 
|---|
| 14 | cor = coroutine() | 
|---|
| 15 | } | 
|---|
| 16 | hrend = process.hrtime( hrstart ) | 
|---|
| 17 | var dur = (1000000000 * hrend[0] + hrend[1]) / times | 
|---|
| 18 | console.log( dur ) | 
|---|
| 19 |  | 
|---|
| 20 | // Local Variables: // | 
|---|
| 21 | // tab-width: 4 // | 
|---|
| 22 | // compile-command: "nodejs node_cor.js" // | 
|---|
| 23 | // End: // | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.