Skip to content

Commit befd49b

Browse files
committed
improve html benchmarking adding tagging
1 parent fc2698b commit befd49b

2 files changed

Lines changed: 54 additions & 34 deletions

File tree

.github/workflows/asv-openmp-pr.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ jobs:
126126
"$BASE_SHA" \
127127
"$HEAD_SHA" \
128128
--machine "$MACHINE_NAME" \
129+
--factor 1.05 \
129130
--split \
130131
| tee .asv-openmp/artifact/comparison.txt
131132
compare_status="${PIPESTATUS[0]}"
@@ -153,11 +154,9 @@ jobs:
153154
if-no-files-found: warn
154155
retention-days: 30
155156

156-
- name: Post benchmark results as PR comment
157+
- name: Write benchmark step summary
157158
if: always()
158159
env:
159-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
160-
PR_NUMBER: ${{ github.event.pull_request.number }}
161160
ARTIFACT_URL: ${{ steps.upload.outputs.artifact-url }}
162161
BASE_SHA: ${{ github.event.pull_request.base.sha }}
163162
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
@@ -210,6 +209,12 @@ jobs:
210209
)
211210
PY
212211
212+
- name: Post benchmark results as PR comment
213+
if: always() && github.event.pull_request.head.repo.full_name == github.repository
214+
env:
215+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
216+
PR_NUMBER: ${{ github.event.pull_request.number }}
217+
run: |
213218
EXISTING_ID=$(gh api \
214219
"repos/$GITHUB_REPOSITORY/issues/$PR_NUMBER/comments" \
215220
--jq '.[] | select(.body | startswith("<!-- gstools-openmp-benchmark -->")) | .id' \

benchmarks/tools/plot_case_backend_comparison.py

Lines changed: 46 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -865,6 +865,26 @@ def render_html(rows):
865865
border-color: var(--accent);
866866
color: var(--accent-strong);
867867
}
868+
.toggle-btn {
869+
background: none;
870+
border: 1px solid var(--line);
871+
border-radius: 4px;
872+
color: var(--muted);
873+
cursor: pointer;
874+
font-size: 11px;
875+
font-weight: 650;
876+
letter-spacing: 0.04em;
877+
padding: 2px 10px;
878+
text-transform: uppercase;
879+
}
880+
.toggle-btn.active {
881+
background: var(--accent-soft);
882+
border-color: var(--accent);
883+
color: var(--accent-strong);
884+
}
885+
.toggle-btn + .toggle-btn {
886+
margin-left: 4px;
887+
}
868888
@media (max-width: 700px) {
869889
header, main {
870890
padding: 18px;
@@ -923,10 +943,6 @@ def render_html(rows):
923943
<legend>View</legend>
924944
<div id="viewMode" class="checkbox-list"></div>
925945
</fieldset>
926-
<fieldset class="filter-control">
927-
<legend>Reference</legend>
928-
<div id="referenceMode" class="checkbox-list"></div>
929-
</fieldset>
930946
<fieldset class="filter-control wide-control">
931947
<legend>Case</legend>
932948
<div id="case" class="checkbox-list"></div>
@@ -935,20 +951,16 @@ def render_html(rows):
935951
<legend>Threads</legend>
936952
<div id="threads" class="checkbox-list"></div>
937953
</fieldset>
938-
<fieldset class="filter-control wide-control" id="commitSection">
939-
<legend>Commit</legend>
954+
<fieldset class="filter-control wide-control">
955+
<legend>
956+
<button id="modeCommit" class="toggle-btn active" onclick="setReferenceMode('commit')">Commits</button>
957+
<button id="modeTag" class="toggle-btn" onclick="setReferenceMode('tag')">Tags</button>
958+
</legend>
940959
<select id="commit" class="multi-select" multiple size="5"></select>
960+
<select id="tag" class="multi-select" multiple size="5" style="display:none"></select>
941961
<div class="select-actions">
942-
<button class="select-action-btn" onclick="selectAllOptions('commit')">All</button>
943-
<button class="select-action-btn" onclick="clearAllOptions('commit')">None</button>
944-
</div>
945-
</fieldset>
946-
<fieldset class="filter-control wide-control" id="tagSection" style="display:none">
947-
<legend>Tag</legend>
948-
<select id="tag" class="multi-select" multiple size="5"></select>
949-
<div class="select-actions">
950-
<button class="select-action-btn" onclick="selectAllOptions('tag')">All</button>
951-
<button class="select-action-btn" onclick="clearAllOptions('tag')">None</button>
962+
<button class="select-action-btn" onclick="selectAllOptions(referenceModeValue())">All</button>
963+
<button class="select-action-btn" onclick="clearAllOptions(referenceModeValue())">None</button>
952964
</div>
953965
</fieldset>
954966
<fieldset class="filter-control">
@@ -981,10 +993,7 @@ def render_html(rows):
981993
bar: "Bar plot",
982994
line: "Line plot"
983995
};
984-
const refLabels = {
985-
commits: "By Commits",
986-
tags: "By Tags"
987-
};
996+
let xMode = "commit";
988997
const metricUnits = {
989998
time: {label: "time", unit: "ms", factor: 1000},
990999
memory: {label: "peak memory", unit: "MiB", factor: 1 / (1024 * 1024)}
@@ -1088,7 +1097,17 @@ def render_html(rows):
10881097
}
10891098
10901099
function referenceModeValue() {
1091-
return checkedValues("referenceMode")[0] || "commits";
1100+
return xMode;
1101+
}
1102+
1103+
function setReferenceMode(mode) {
1104+
xMode = mode;
1105+
document.getElementById("modeCommit").classList.toggle("active", mode === "commit");
1106+
document.getElementById("modeTag").classList.toggle("active", mode === "tag");
1107+
document.getElementById("commit").style.display = mode === "tag" ? "none" : "";
1108+
document.getElementById("tag").style.display = mode === "tag" ? "" : "none";
1109+
refreshOptions();
1110+
renderAll();
10921111
}
10931112
10941113
function setCheckboxes(
@@ -1172,7 +1191,7 @@ def render_html(rows):
11721191
const cases = checkedValues("case");
11731192
const threads = checkedValues("threads");
11741193
const selectedBackends = checkedValues("backend");
1175-
const isTagMode = referenceModeValue() === "tags";
1194+
const isTagMode = referenceModeValue() === "tag";
11761195
const xFilter = isTagMode
11771196
? (row => row.tag && selectedOptions("tag").includes(row.tag))
11781197
: (row => selectedOptions("commit").includes(row.commit));
@@ -1196,7 +1215,6 @@ def render_html(rows):
11961215
metrics: checkedValues("metric"),
11971216
families: checkedValues("family"),
11981217
viewModes: checkedValues("viewMode"),
1199-
refModes: checkedValues("referenceMode"),
12001218
cases: checkedValues("case"),
12011219
threads: checkedValues("threads"),
12021220
commits: selectedOptions("commit"),
@@ -1212,10 +1230,7 @@ def render_html(rows):
12121230
const defaultFamily = familyOptions.includes("krige") ? "krige" : familyOptions[0];
12131231
setCheckboxes("family", familyOptions, previousMain.families, {}, [defaultFamily]);
12141232
setCheckboxes("viewMode", ["line", "bar"], previousMain.viewModes, modeLabels, ["line"]);
1215-
setCheckboxes("referenceMode", ["commits", "tags"], previousMain.refModes, refLabels, ["commits"]);
1216-
const isTagMode = referenceModeValue() === "tags";
1217-
document.getElementById("commitSection").style.display = isTagMode ? "none" : "";
1218-
document.getElementById("tagSection").style.display = isTagMode ? "" : "none";
1233+
const isTagMode = referenceModeValue() === "tag";
12191234
const benchRows = benchmarkRows();
12201235
const caseOptions = unique(benchRows.map(row => row.case));
12211236
const defaultCase = caseOptions.find(value => value.includes("extra_large")) || caseOptions[0];
@@ -1282,7 +1297,7 @@ def render_html(rows):
12821297
}
12831298
12841299
function barGroupKey(row) {
1285-
const xKey = referenceModeValue() === "tags" ? row.tag : row.commit;
1300+
const xKey = referenceModeValue() === "tag" ? row.tag : row.commit;
12861301
return `${row.case}|${row.threads}|${xKey}`;
12871302
}
12881303
@@ -1306,7 +1321,7 @@ def render_html(rows):
13061321
function chartSubtitle(data) {
13071322
const cases = checkedValues("case");
13081323
const threads = checkedValues("threads");
1309-
const isTagMode = referenceModeValue() === "tags";
1324+
const isTagMode = referenceModeValue() === "tag";
13101325
const xValues = isTagMode ? selectedOptions("tag") : selectedOptions("commit");
13111326
const noun = isTagMode ? "tags" : "commits";
13121327
const selectedBackends = checkedValues("backend").map(value => labels[value] || value);
@@ -1402,7 +1417,7 @@ def render_html(rows):
14021417
const legend = document.getElementById("legend");
14031418
const metric = data[0].metric;
14041419
const unit = metricUnits[metric];
1405-
const isTagMode = referenceModeValue() === "tags";
1420+
const isTagMode = referenceModeValue() === "tag";
14061421
const rowXKey = row => isTagMode ? row.tag : row.commit;
14071422
const xKeys = isTagMode
14081423
? tagOrder(data.map(rowXKey))
@@ -1490,7 +1505,7 @@ def render_html(rows):
14901505
renderChart();
14911506
}
14921507
1493-
for (const id of ["metric", "family", "viewMode", "referenceMode"]) {
1508+
for (const id of ["metric", "family", "viewMode"]) {
14941509
document.getElementById(id).addEventListener("change", event => {
14951510
enforceSingleChoice(id, event);
14961511
refreshOptions();

0 commit comments

Comments
 (0)