diff --git a/test/perf.test.js b/test/perf.test.js index 66945efa0..89c15c3d0 100644 --- a/test/perf.test.js +++ b/test/perf.test.js @@ -1,5 +1,7 @@ -var parser = require("./main"); - +const parser = require("./main"); +const os = require("os"); +const cpus = os.cpus(); +const cpuId = cpus.length + "@" + cpus[0].speed + 'Mhz'; describe("Performance tests", function() { var code = ` 1000) { speed = speed / 1000; - speed = Math.round(speed * 100) / 100 + "M"; + speed = Math.round(speed * 100) / 100 + "M Tokens"; } else { - speed = Math.round(speed * 100) / 100 + "K"; + speed = Math.round(speed * 100) / 100 + "K Tokens"; } } console.log(" + Tokens speed => " + speed + "/sec"); @@ -48,12 +51,12 @@ describe("Performance tests", function() { speed = speed / 1024; if (speed > 1024) { speed = speed / 1024; - speed = Math.round(speed * 100) / 100 + "M"; + speed = Math.round(speed * 100) / 100 + " Mb"; } else { - speed = Math.round(speed * 100) / 100 + "K"; + speed = Math.round(speed * 100) / 100 + " Kb"; } } - console.log(" + Reading speed => " + speed + "/sec"); + console.log(" + Reading bandwidth => " + speed + "/sec"); }); it("parser", function() { @@ -93,9 +96,9 @@ describe("Performance tests", function() { speed = speed / 1000; if (speed > 1000) { speed = speed / 1000; - speed = Math.round(speed * 100) / 100 + "M"; + speed = Math.round(speed * 100) / 100 + "M Nodes"; } else { - speed = Math.round(speed * 100) / 100 + "K"; + speed = Math.round(speed * 100) / 100 + "K Nodes"; } } console.log(" + Nodes speed => " + speed + "/sec"); @@ -107,11 +110,11 @@ describe("Performance tests", function() { speed = speed / 1024; if (speed > 1024) { speed = speed / 1024; - speed = Math.round(speed * 100) / 100 + "M"; + speed = Math.round(speed * 100) / 100 + " Mb"; } else { - speed = Math.round(speed * 100) / 100 + "K"; + speed = Math.round(speed * 100) / 100 + " Kb"; } } - console.log(" + Overall speed => " + speed + "/sec"); + console.log(" + Overall bandwidth => " + speed + "/sec"); }); }); diff --git a/test/perf/class.php b/test/perf/class.php new file mode 100644 index 000000000..e69de29bb diff --git a/test/perf/statistics.json b/test/perf/statistics.json new file mode 100644 index 000000000..bd1b4fd22 --- /dev/null +++ b/test/perf/statistics.json @@ -0,0 +1,21 @@ +{ + "threshold": { + "tokens": 0.95, + "nodes": 0.9 + }, + "versions": { + "3.0.0-prerelease.9": { + "12@3674Mhz": { + "model": "AMD Ryzen 5 2600 Six-Core Processor", + "files": { + "class.php": { + "tokensPerSec": 29091000, + "tokenBandwidth": 61984000, + "nodesPerSec": 7731000, + "parseBandwidth": 20513000 + } + } + } + } + } +} \ No newline at end of file