From 11ff0941c8ebc50f22804e15c8a87ab31792c06c Mon Sep 17 00:00:00 2001 From: DrMaxNix Date: Thu, 8 Sep 2022 14:04:58 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A8=20add=20benchmarking=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dev/index.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/dev/index.php b/dev/index.php index 43fcd51..442f873 100644 --- a/dev/index.php +++ b/dev/index.php @@ -103,12 +103,23 @@ }); document.addEventListener("DOMContentLoaded", function(){ + // handle missing source file if(juice_program === false){ juicescript.io.stderr.error("No source file found! Add one at 'dev/juice-program.jce'"); return; } + // parse source code + /**/const parse_start = performance.now(); juicescript.parse(juice_program); + /**/const parse_end = performance.now(); + /**/juicescript.io.stderr.info("Parsing took " + (parse_end - parse_start) + "ms"); + + // execute program + /**/const run_start = performance.now(); + juicescript.run(); + /**/const run_end = performance.now(); + /**/juicescript.io.stderr.info("Running took " + (run_end - run_start) + "ms"); });