From 374d08e6ea2407a799e52d9c9249cce7c969f45b Mon Sep 17 00:00:00 2001 From: mmcw-dev Date: Sat, 16 Jun 2018 18:50:01 -0400 Subject: [PATCH] Profile script for timing new vs old mscript --- app/test/mscript_profile.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 app/test/mscript_profile.js diff --git a/app/test/mscript_profile.js b/app/test/mscript_profile.js new file mode 100644 index 0000000..47f9c22 --- /dev/null +++ b/app/test/mscript_profile.js @@ -0,0 +1,26 @@ +'use strict'; + +//the purpose of this script is to test the performance of the +//mscript rewrite against the original + +const mscript = require('../lib/mscript'); +const mscriptOld = require('../lib/mscript/index.old.js'); + +mscriptOld.state_clear(); +console.time('mscript old str_to_arr'); + + +for (let i = 0; i < 100000; i++) { + mscriptOld.str_to_arr('BF 2222', 'BF'); +} + +console.timeEnd('mscript old str_to_arr') + +mscript.state_clear(); +console.time('mscript str_to_arr'); + +for (let i = 0; i < 100000; i++) { + mscript.str_to_arr('BF 2222', 'BF'); +} + +console.timeEnd('mscript str_to_arr'); \ No newline at end of file