Skip to content

Commit

Permalink
update to not filter out based off time
Browse files Browse the repository at this point in the history
  • Loading branch information
vezenovm committed Dec 7, 2024
1 parent ff50b92 commit d4a37a3
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 23 deletions.
12 changes: 2 additions & 10 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ const computeCompilationDiff = (refReports, compilationReports) => {
if (refReports.length === compilationReports.length) {
for (let i = 0; i < refReports.length; i++) {
let diff_str = "N/A";
let minSeconds = 0;
if (refReports[i].artifact_name === compilationReports[i].artifact_name) {
const compTimeString = compilationReports[i].time;
const refTimeString = refReports[i].time;
Expand All @@ -43,26 +42,19 @@ const computeCompilationDiff = (refReports, compilationReports) => {
const refSecondsString = refTimeSegments[1];
const refSecondsValue = parseFloat(refSecondsString.substring(0, refSecondsString.length - 1));
const refSeconds = refMinutesValue * 60 + refSecondsValue;
minSeconds = Math.min(refSeconds, compSeconds);
const diff = Math.floor(((compSeconds - refSeconds) / refSeconds) * 100);
if (diff != 0) {
diff_column = true;
}
diff_str = diff.toString() + "%";
}
// Reports under one seconds can often vary in their diff percentage by quite a bit more (e.g. .2 ms to .25 ms),
// which can make it more difficult to interpret the output
if (minSeconds > 1) {
diff_percentage.push({ report_index: i, diff_str: diff_str });
}
diff_percentage.push(diff_str);
}
}
if (diff_column == true) {
markdown = "## Compilation Sample\n | Program | Compilation Time | % |\n | --- | --- | --- |\n";
for (let i = 0; i < diff_percentage.length; i++) {
const diffRow = diff_percentage[i];
const reportIndex = diffRow.report_index;
markdown = markdown.concat(" | ", compilationReports[reportIndex].artifact_name, " | ", compilationReports[reportIndex].time, " | ", diffRow.diff_str, " |\n");
markdown = markdown.concat(" | ", compilationReports[i].artifact_name, " | ", compilationReports[i].time, " | ", diff_percentage[i], " |\n");
}
}
else {
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

16 changes: 4 additions & 12 deletions src/compilation_report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export const computeCompilationDiff = (
if (refReports.length === compilationReports.length) {
for (let i = 0; i < refReports.length; i++) {
let diff_str = "N/A";
let minSeconds = 0;
if (refReports[i].artifact_name === compilationReports[i].artifact_name) {
const compTimeString = compilationReports[i].time;
const refTimeString = refReports[i].time;
Expand All @@ -50,7 +49,6 @@ export const computeCompilationDiff = (
refSecondsString.substring(0, refSecondsString.length - 1)
);
const refSeconds = refMinutesValue * 60 + refSecondsValue;
minSeconds = Math.min(refSeconds, compSeconds);

const diff = Math.floor(((compSeconds - refSeconds) / refSeconds) * 100);
if (diff != 0) {
Expand All @@ -59,26 +57,20 @@ export const computeCompilationDiff = (
diff_str = diff.toString() + "%";
}

// Reports under one seconds can often vary in their diff percentage by quite a bit more (e.g. .2 ms to .25 ms),
// which can make it more difficult to interpret the output
if (minSeconds > 1) {
diff_percentage.push({ report_index: i, diff_str: diff_str });
}
diff_percentage.push(diff_str);
}
}

if (diff_column == true) {
markdown = "## Compilation Sample\n | Program | Compilation Time | % |\n | --- | --- | --- |\n";
for (let i = 0; i < diff_percentage.length; i++) {
const diffRow = diff_percentage[i];
const reportIndex = diffRow.report_index;
markdown = markdown.concat(
" | ",
compilationReports[reportIndex].artifact_name,
compilationReports[i].artifact_name,
" | ",
compilationReports[reportIndex].time,
compilationReports[i].time,
" | ",
diffRow.diff_str,
diff_percentage[i],
" |\n"
);
}
Expand Down
2 changes: 2 additions & 0 deletions tests/mocks/1-2-compilation.md
Original file line number Diff line number Diff line change
@@ -1,5 +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% |

0 comments on commit d4a37a3

Please sign in to comment.