| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent a5d27f3 commit 98b2eae
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,20 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + var common = require('../common.js'); | ||
| 3 | + | ||
| 4 | + var bench = common.createBenchmark(main, { | ||
| 5 | + thousands: [500], | ||
| 6 | + }); | ||
| 7 | + | ||
| 8 | + function main(conf) { | ||
| 9 | + var N = +conf.thousands * 1e3; | ||
| 10 | + var n = 0; | ||
| 11 | + bench.start(); | ||
| 12 | + function cb() { | ||
| 13 | + n++; | ||
| 14 | + if (n === N) | ||
| 15 | + bench.end(N / 1e3); | ||
| 16 | + } | ||
| 17 | + for (var i = 0; i < N; i++) { | ||
| 18 | + setTimeout(cb, 1); | ||
| 19 | + } | ||
| 20 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,20 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + var common = require('../common.js'); | ||
| 3 | + | ||
| 4 | + var bench = common.createBenchmark(main, { | ||
| 5 | + thousands: [1], | ||
| 6 | + }); | ||
| 7 | + | ||
| 8 | + function main(conf) { | ||
| 9 | + var N = +conf.thousands * 1e3; | ||
| 10 | + var n = 0; | ||
| 11 | + bench.start(); | ||
| 12 | + setTimeout(cb, 1); | ||
| 13 | + function cb() { | ||
| 14 | + n++; | ||
| 15 | + if (n === N) | ||
| 16 | + bench.end(N / 1e3); | ||
| 17 | + else | ||
| 18 | + setTimeout(cb, 1); | ||
| 19 | + } | ||
| 20 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments