summaryrefslogtreecommitdiff
path: root/node_modules/webworker-threads/test/test23_create_destroy_loop.js
diff options
context:
space:
mode:
authoryo mama <pepper@scannerjammer.com>2015-04-04 01:00:59 -0700
committeryo mama <pepper@scannerjammer.com>2015-04-04 01:00:59 -0700
commitc7c22e3db1c826bcfb2bc66651ec480aae0d4ae0 (patch)
tree8546df448afef40d3814d2581f4dacff7cebb87f /node_modules/webworker-threads/test/test23_create_destroy_loop.js
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.js25
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