diff options
Diffstat (limited to 'node_modules/webworker-threads/test/test23_create_destroy_loop.js')
| -rw-r--r-- | node_modules/webworker-threads/test/test23_create_destroy_loop.js | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/node_modules/webworker-threads/test/test23_create_destroy_loop.js b/node_modules/webworker-threads/test/test23_create_destroy_loop.js new file mode 100644 index 0000000..3284e28 --- /dev/null +++ b/node_modules/webworker-threads/test/test23_create_destroy_loop.js @@ -0,0 +1,25 @@ + + +var T= require('webworker-threads'); + + +var i= 0; +var k= 5; +(function again () { + var j= k; + while (j--) { + T.create().destroy(); + } + i+= k; + setTimeout(again, 5); +})(); + + +var t= Date.now(); +function display () { + var e= Date.now()- t; + var tps= (i*1e3/e).toFixed(1); + process.stdout.write('\nt (ms) -> '+ e+ ', i -> '+ i+ ', created/destroyed-per-second -> '+ tps); +} + +setInterval(display, 1e3);
\ No newline at end of file |
