Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
oflatt committed Feb 7, 2025
1 parent 60ab97b commit 08f035f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 18 deletions.
34 changes: 19 additions & 15 deletions infra/nightly-resources/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,18 @@ const GLOBAL_DATA = {
// using checkedSuites and checkedBenchmarks
function enabledBenchmarks() {
return Array.from(GLOBAL_DATA.checkedBenchmarks).filter((benchmark) =>
GLOBAL_DATA.checkedSuites.has(getRow(benchmark, BASELINE_MODE).suite))
GLOBAL_DATA.checkedSuites.has(getRow(benchmark, BASELINE_MODE).suite),
);
}

// filter current run for enabled benchmarks
// and by checked run modes
function enabledSubsetOfCurrentRun() {
const benchmarks = enabledBenchmarks();
return GLOBAL_DATA.currentRun.filter((entry) =>
GLOBAL_DATA.checkedModes.has(entry.runMethod) && benchmarks.includes(entry),
return GLOBAL_DATA.currentRun.filter(
(entry) =>
GLOBAL_DATA.checkedModes.has(entry.runMethod) &&
benchmarks.includes(entry),
);
}

Expand Down Expand Up @@ -68,7 +71,12 @@ function addTableTo(element, data, title) {
const copyMacrosButton = document.createElement("button");
copyMacrosButton.innerText = "Copy Latex Macros";
copyMacrosButton.onclick = () => {
const macros = nestedJsonToLatexMacros(data, "name", "executions", "runMethod");
const macros = nestedJsonToLatexMacros(
data,
"name",
"executions",
"runMethod",
);
console.log("macros");
console.log(macros);
navigator.clipboard.writeText(macros);
Expand All @@ -86,10 +94,10 @@ function addTableTo(element, data, title) {
function tableForSuite(suite) {
const byBench = {};
Array.from(GLOBAL_DATA.checkedBenchmarks)
.filter((benchmark) => getRow(benchmark, BASELINE_MODE).suite === suite)
.forEach((benchmark) => {
byBench[benchmark] = getDataForBenchmark(benchmark);
});
.filter((benchmark) => getRow(benchmark, BASELINE_MODE).suite === suite)
.forEach((benchmark) => {
byBench[benchmark] = getDataForBenchmark(benchmark);
});
const tableData = Object.keys(byBench).map((bench) => ({
name: `<a target="_blank" rel="noopener noreferrer" href="https://github.com/egraphs-good/eggcc/tree/main/${getBrilPathForBenchmark(
bench,
Expand All @@ -100,7 +108,6 @@ function tableForSuite(suite) {
return tableData;
}


function dedup(arr) {
return Array.from(new Set(arr));
}
Expand All @@ -109,15 +116,16 @@ function getSuites() {
return dedup(GLOBAL_DATA.currentRun.map((benchmark) => benchmark.suite));
}


function refreshView() {
if (!GLOBAL_DATA.baselineRun) {
addWarning("no baseline to compare to");
}

// clear the tables element
while (document.getElementById("tables").firstChild) {
document.getElementById("tables").removeChild(document.getElementById("tables").firstChild);
document
.getElementById("tables")
.removeChild(document.getElementById("tables").firstChild);
}

// fill in the overall stats table
Expand All @@ -126,15 +134,11 @@ function refreshView() {
console.log("here");
addTableTo(document.getElementById("tables"), overallStats, "Overall Stats");


for (const suite of getSuites()) {
const tableData = tableForSuite(suite);
addTableTo(document.getElementById("tables"), tableData, suite + " Stats");
}




renderWarnings();
refreshChart();
refreshLatexMacros();
Expand Down
5 changes: 2 additions & 3 deletions infra/nightly-resources/latex.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ function convertStringToValidLatexVar(str) {
if (str.includes("<")) {
var div = document.createElement("div");
div.innerHTML = str;
str = div.textContent
str = div.textContent;
}
return str.replace(/-/g, "_");
}
Expand Down Expand Up @@ -159,7 +159,6 @@ function jsonToLatexMacros(json, rowIndex, prefix) {
return res;
}


// given a json like the following:
/// [{ "name": "raytrace", "executions": { data: other_table} }] ...
/// Call jsonToLatexMacros on the other_table for each row index with the prefix name
Expand All @@ -174,4 +173,4 @@ function nestedJsonToLatexMacros(json, rowIndex, tableIndex, nestedRowIndex) {
}

return res;
}
}

0 comments on commit 08f035f

Please sign in to comment.