cronometro
Advanced tools
Comparing version 0.1.0 to 0.2.0
@@ -0,3 +1,7 @@ | ||
### 2020-01-29 / 0.2.0 | ||
- fix: Improve scheduling to avoid races. | ||
### 2020-01-29 / 0.1.0 | ||
- Initial version. |
@@ -9,2 +9,6 @@ 'use strict'; | ||
const print_1 = require("./print"); | ||
const debug = (process.env.NODE_DEBUG || '').includes('cronometro'); | ||
function schedule(operation) { | ||
process.nextTick(operation); | ||
} | ||
function runIteration(context) { | ||
@@ -15,3 +19,3 @@ function trackResults(error) { | ||
context.results[context.current.name] = { success: false, error }; | ||
processQueue(context); | ||
schedule(() => processQueue(context)); | ||
return; | ||
@@ -39,8 +43,11 @@ } | ||
}; | ||
processQueue(context); | ||
schedule(() => processQueue(context)); | ||
return; | ||
} | ||
context.current.remaining--; | ||
process.nextTick(() => runIteration(context)); | ||
schedule(() => runIteration(context)); | ||
} | ||
if (debug) { | ||
console.debug(`cronometro: Executing test ${context.current.name}, ${context.current.remaining} iterations to go`); | ||
} | ||
const start = process.hrtime.bigint(); | ||
@@ -59,3 +66,3 @@ try { | ||
context.results[context.current.name] = { success: false, error }; | ||
processQueue(context); | ||
schedule(() => processQueue(context)); | ||
} | ||
@@ -77,3 +84,3 @@ } | ||
}; | ||
process.nextTick(() => runIteration(testContext)); | ||
schedule(() => runIteration(testContext)); | ||
} | ||
@@ -129,3 +136,3 @@ function cronometro(tests, options, callback) { | ||
}; | ||
processQueue(context); | ||
schedule(() => processQueue(context)); | ||
return promise; | ||
@@ -132,0 +139,0 @@ } |
{ | ||
"name": "cronometro", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "Simple benchmarking suite powered by HDR histograms.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://sw.cowtech.it/cronometro", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18960
303
2