aboutsummaryrefslogtreecommitdiff
path: root/dev/schema-validate.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-05-22 15:19:56 -0400
committerGitHub <noreply@github.com>2021-05-22 15:19:56 -0400
commitb48052ff320f1a68aac317158c4c757a70b14f04 (patch)
tree0770c400da39e5de6c9209e070320c1f26bd859e /dev/schema-validate.js
parentcb0e8ef2359ef8682060c65cecdd42b4dad35316 (diff)
Add timing information to schema-validate.js (#1696)
Diffstat (limited to 'dev/schema-validate.js')
-rw-r--r--dev/schema-validate.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/dev/schema-validate.js b/dev/schema-validate.js
index 1cb69618..45285700 100644
--- a/dev/schema-validate.js
+++ b/dev/schema-validate.js
@@ -16,6 +16,7 @@
*/
const fs = require('fs');
+const {performance} = require('perf_hooks');
const {VM} = require('./vm');
const vm = new VM();
@@ -41,13 +42,17 @@ function main() {
const schema = JSON.parse(schemaSource);
for (const dataFileName of args.slice(1)) {
+ const start = performance.now();
try {
console.log(`Validating ${dataFileName}...`);
const dataSource = fs.readFileSync(dataFileName, {encoding: 'utf8'});
const data = JSON.parse(dataSource);
new JsonSchemaValidator().validate(data, schema);
- console.log('No issues found');
+ const end = performance.now();
+ console.log(`No issues detected (${((end - start) / 1000).toFixed(2)}s)`);
} catch (e) {
+ const end = performance.now();
+ console.log(`Encountered an error (${((end - start) / 1000).toFixed(2)}s)`);
console.warn(e);
}
}