Skip to content

Commit

Permalink
release
Browse files Browse the repository at this point in the history
  • Loading branch information
vezenovm committed Dec 6, 2024
1 parent 7e581c9 commit ff50b92
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 1 deletion.
82 changes: 82 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,80 @@
require('./sourcemap-register.js');/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({

/***/ 6423:
/***/ ((__unused_webpack_module, exports) => {

"use strict";

Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.computeCompilationDiff = exports.formatCompilationReport = exports.compilationReports = void 0;
const compilationReports = (content) => {
return JSON.parse(content).compilation_reports;
};
exports.compilationReports = compilationReports;
const formatCompilationReport = (compilationReports) => {
let markdown = "## Compilation Sample\n | Program | Compilation Time |\n | --- | --- |\n";
for (let i = 0; i < compilationReports.length; i++) {
markdown = markdown.concat(" | ", compilationReports[i].artifact_name, " | ", compilationReports[i].time, " |\n");
}
return markdown;
};
exports.formatCompilationReport = formatCompilationReport;
const computeCompilationDiff = (refReports, compilationReports) => {
let markdown = "";
const diff_percentage = [];
let diff_column = false;
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;
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;
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 });
}
}
}
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");
}
}
else {
markdown = (0, exports.formatCompilationReport)(compilationReports);
}
return markdown;
};
exports.computeCompilationDiff = computeCompilationDiff;


/***/ }),

/***/ 4822:
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {

Expand Down Expand Up @@ -55,6 +129,7 @@ const path_1 = __nccwpck_require__(1017);
const artifact = __importStar(__nccwpck_require__(2605));
const core = __importStar(__nccwpck_require__(2186));
const github_1 = __nccwpck_require__(5438);
const compilation_report_1 = __nccwpck_require__(6423);
const report_1 = __nccwpck_require__(8269);
const token = process.env.GITHUB_TOKEN || core.getInput("token");
const report = core.getInput("report");
Expand Down Expand Up @@ -160,6 +235,13 @@ function run() {
const markdown = (0, report_1.computeMemoryDiff)(referenceReports, memoryContent);
core.setOutput("markdown", markdown);
}
else {
core.info(`Format Compilation report markdown rows`);
const compilationContent = (0, report_1.compilationReports)(compareContent);
const referenceReports = (0, report_1.compilationReports)(referenceContent);
const markdown = (0, compilation_report_1.computeCompilationDiff)(referenceReports, compilationContent);
core.setOutput("markdown", markdown);
}
core.endGroup();
}
catch (error) {
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

0 comments on commit ff50b92

Please sign in to comment.