Skip to content

Node.js based forum software built for the modern web

added forEach test

Baris Soner Usakli12f78f5d568d
diff --git a/src/routes/testbed.js b/src/routes/testbed.js
index 2abc87fe60..67ef148566 100644
--- a/src/routes/testbed.js
+++ b/src/routes/testbed.js
@@ -40,13 +40,27 @@
var diff = process.hrtime(time);
diff = diff[0] + diff[1] / 1e9;
return diff;
+ }
+
+ function withForeach() {
+ var time = process.hrtime();
+ for(var n=0; n<runCount; ++n) {
+ myArray.forEach(function(index) {
+
+ });
+ }
+
+ var diff = process.hrtime(time);
+ diff = diff[0] + diff[1] / 1e9;
+ return diff;
}
benchData['runs'] = runCount;
benchData['withCaching'] = withCaching();
benchData['withoutCaching'] = withoutCaching();
+ benchData['withForeach'] = withForeach();
res.json(benchData);