2018-06-16 22:50:01 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
//the purpose of this script is to test the performance of the
|
|
|
|
//mscript rewrite against the original
|
|
|
|
|
2018-06-16 23:30:15 +00:00
|
|
|
const Mscript = require('../lib/mscript');
|
|
|
|
const mscript = new Mscript();
|
2018-06-16 22:50:01 +00:00
|
|
|
const mscriptOld = require('../lib/mscript/index.old.js');
|
|
|
|
|
2018-06-17 01:33:53 +00:00
|
|
|
|
2018-06-17 02:48:11 +00:00
|
|
|
mscript.interpret(`F 72 0,0,0 10,20,30
|
2018-06-17 01:33:53 +00:00
|
|
|
CF
|
|
|
|
END
|
2018-06-17 02:48:11 +00:00
|
|
|
PF 10
|
2018-06-17 01:33:53 +00:00
|
|
|
`, (output) => {
|
|
|
|
console.dir(output)
|
|
|
|
});
|
|
|
|
|
|
|
|
process.exit()
|
|
|
|
|
2018-06-16 22:50:01 +00:00
|
|
|
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')
|
|
|
|
|
2018-06-16 23:30:15 +00:00
|
|
|
mscript.clear()
|
2018-06-16 22:50:01 +00:00
|
|
|
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');
|