From cb0d9f3a66db3c02b6386132b3f19b8df34c13a1 Mon Sep 17 00:00:00 2001 From: Tomas Chmelevskij Date: Mon, 8 Feb 2021 18:25:12 +0100 Subject: [PATCH] feat: use `console.time` for timing --- src/js/workers/hex_parser.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/js/workers/hex_parser.js b/src/js/workers/hex_parser.js index 0f946260..19bb501b 100644 --- a/src/js/workers/hex_parser.js +++ b/src/js/workers/hex_parser.js @@ -93,13 +93,14 @@ function read_hex_file(data) { } } +const TIME_LABEL = 'HEX_PARSER - File parsed in'; + onmessage = function(event) { - const timeParsingStart = microtime(); // track time + console.time(TIME_LABEL) read_hex_file(event.data); - console.log(`HEX_PARSER - File parsed in: ${(microtime() - timeParsingStart).toFixed(4)} seconds`); - // terminate worker + console.timeEnd(TIME_LABEL); close(); };