Skip to content

Commit

Permalink
expect time to come as seconds
Browse files Browse the repository at this point in the history
  • Loading branch information
vezenovm committed Dec 19, 2024
1 parent c05e03e commit 81d04cb
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 67 deletions.
28 changes: 4 additions & 24 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,8 @@ const computeCompilationDiff = (refReports, compilationReports) => {
if (refReports[i].artifact_name === compilationReports[i].artifact_name) {
const compTimeString = compilationReports[i].time;
const refTimeString = refReports[i].time;
const compTimeSegments = compTimeString.split("m");
const refTimeSegments = refTimeString.split("m");
const minutesString = compTimeSegments[0];
const refMinutesString = refTimeSegments[0];
const compMinutesValue = parseInt(minutesString);
const refMinutesValue = parseInt(refMinutesString);
const secondsString = compTimeSegments[1];
const compSecondsValue = parseFloat(secondsString.substring(0, secondsString.length - 1));
const compSeconds = compMinutesValue * 60 + compSecondsValue;
const refSecondsString = refTimeSegments[1];
const refSecondsValue = parseFloat(refSecondsString.substring(0, refSecondsString.length - 1));
const refSeconds = refMinutesValue * 60 + refSecondsValue;
const compSeconds = parseFloat(compTimeString.substring(0, compTimeString.length - 1));
const refSeconds = parseFloat(refTimeString.substring(0, refTimeString.length - 1));
const diff = Math.floor(((compSeconds - refSeconds) / refSeconds) * 100);
if (diff != 0) {
diff_column = true;
Expand Down Expand Up @@ -96,18 +86,8 @@ const computeExecutionDiff = (refReports, executionReports) => {
if (refReports[i].artifact_name === executionReports[i].artifact_name) {
const compTimeString = executionReports[i].time;
const refTimeString = refReports[i].time;
const compTimeSegments = compTimeString.split("m");
const refTimeSegments = refTimeString.split("m");
const minutesString = compTimeSegments[0];
const refMinutesString = refTimeSegments[0];
const compMinutesValue = parseInt(minutesString);
const refMinutesValue = parseInt(refMinutesString);
const secondsString = compTimeSegments[1];
const compSecondsValue = parseFloat(secondsString.substring(0, secondsString.length - 1));
const compSeconds = compMinutesValue * 60 + compSecondsValue;
const refSecondsString = refTimeSegments[1];
const refSecondsValue = parseFloat(refSecondsString.substring(0, refSecondsString.length - 1));
const refSeconds = refMinutesValue * 60 + refSecondsValue;
const compSeconds = parseFloat(compTimeString.substring(0, compTimeString.length - 1));
const refSeconds = parseFloat(refTimeString.substring(0, refTimeString.length - 1));
const diff = Math.floor(((compSeconds - refSeconds) / refSeconds) * 100);
if (diff != 0) {
diff_column = true;
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

19 changes: 2 additions & 17 deletions src/compilation_report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,9 @@ export const computeCompilationDiff = (
if (refReports[i].artifact_name === compilationReports[i].artifact_name) {
const compTimeString = compilationReports[i].time;
const refTimeString = refReports[i].time;
const compTimeSegments = compTimeString.split("m");
const refTimeSegments = refTimeString.split("m");

const minutesString = compTimeSegments[0];
const refMinutesString = refTimeSegments[0];

const compMinutesValue = parseInt(minutesString);
const refMinutesValue = parseInt(refMinutesString);

const secondsString = compTimeSegments[1];
const compSecondsValue = parseFloat(secondsString.substring(0, secondsString.length - 1));
const compSeconds = compMinutesValue * 60 + compSecondsValue;

const refSecondsString = refTimeSegments[1];
const refSecondsValue = parseFloat(
refSecondsString.substring(0, refSecondsString.length - 1)
);
const refSeconds = refMinutesValue * 60 + refSecondsValue;
const compSeconds = parseFloat(compTimeString.substring(0, compTimeString.length - 1));
const refSeconds = parseFloat(refTimeString.substring(0, refTimeString.length - 1));

const diff = Math.floor(((compSeconds - refSeconds) / refSeconds) * 100);
if (diff != 0) {
Expand Down
19 changes: 2 additions & 17 deletions src/execution_report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,9 @@ export const computeExecutionDiff = (
if (refReports[i].artifact_name === executionReports[i].artifact_name) {
const compTimeString = executionReports[i].time;
const refTimeString = refReports[i].time;
const compTimeSegments = compTimeString.split("m");
const refTimeSegments = refTimeString.split("m");

const minutesString = compTimeSegments[0];
const refMinutesString = refTimeSegments[0];

const compMinutesValue = parseInt(minutesString);
const refMinutesValue = parseInt(refMinutesString);

const secondsString = compTimeSegments[1];
const compSecondsValue = parseFloat(secondsString.substring(0, secondsString.length - 1));
const compSeconds = compMinutesValue * 60 + compSecondsValue;

const refSecondsString = refTimeSegments[1];
const refSecondsValue = parseFloat(
refSecondsString.substring(0, refSecondsString.length - 1)
);
const refSeconds = refMinutesValue * 60 + refSecondsValue;
const compSeconds = parseFloat(compTimeString.substring(0, compTimeString.length - 1));
const refSeconds = parseFloat(refTimeString.substring(0, refTimeString.length - 1));

const diff = Math.floor(((compSeconds - refSeconds) / refSeconds) * 100);
if (diff != 0) {
Expand Down
8 changes: 4 additions & 4 deletions tests/mocks/1-1-compilation-report.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
{"compilation_reports": [
{
"artifact_name":"keccak256",
"time":"0m0.280s"
"time":"0.280s"

},
{
"artifact_name":"workspace",
"time":"0m0.271s"
"time":"0.271s"

},
{
"artifact_name":"regression_4709",
"time":"0m1.796s"
"time":"1.796s"

},
{
"artifact_name":"ram_blowup_regression",
"time":"0m20.566s"
"time":"20.566s"

}
]}
8 changes: 4 additions & 4 deletions tests/mocks/1-2-compilation.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## Compilation Sample
| Program | Compilation Time | % |
| --- | --- | --- |
| keccak256 | 0m0.325s | 16% |
| workspace | 0m0.300s | 10% |
| regression_4709 | 0m1.842s | 2% |
| ram_blowup_regression | 0m20.526s | -1% |
| keccak256 | 0m0.325s | -100% |
| workspace | 0m0.300s | -100% |
| regression_4709 | 0m1.842s | -100% |
| ram_blowup_regression | 0m20.526s | -100% |

0 comments on commit 81d04cb

Please sign in to comment.