We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7e5cd08 commit 3761be3Copy full SHA for 3761be3
2 files changed
benchmark/misc/timers.js
@@ -0,0 +1,40 @@
1
+var common = require('../common.js');
2
+
3
+var bench = common.createBenchmark(main, {
4
+ thousands: [500],
5
+ type: ['depth', 'breadth']
6
+});
7
8
+function main(conf) {
9
+ var n = +conf.thousands * 1e3;
10
+ if (conf.type === 'breadth')
11
+ breadth(n);
12
+ else
13
+ depth(n);
14
+}
15
16
+function depth(N) {
17
+ var n = 0;
18
+ bench.start();
19
+ setTimeout(cb);
20
+ function cb() {
21
+ n++;
22
+ if (n === N)
23
+ bench.end(N / 1e3);
24
25
26
+ }
27
28
29
+function breadth(N) {
30
31
32
33
34
35
36
37
+ for (var i = 0; i < N; i++) {
38
39
40
benchmark/timers.js
0 commit comments