Skip to content

Commit 27dbe63

Browse files
Rework detailed query to properly compare two commits
1 parent 8aa1a22 commit 27dbe63

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

site/static/detailed-query.html

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ <h3 id="title"></h3>
6868
}
6969

7070
function fmt_delta(from, to) {
71-
let delta = from - to;
72-
let pct = (from - to) / to * 100;
71+
let delta = to - from;
72+
let pct = (to - from) / from * 100;
7373
if (from == to) {
7474
pct = 0;
7575
}
@@ -87,7 +87,7 @@ <h3 id="title"></h3>
8787
if (Math.abs(delta) <= 0.05) {
8888
classes = "neutral";
8989
}
90-
return `<span class="${classes}" title="${from.toFixed(3)} - ${to.toFixed(3)}${delta.toFixed(3)}">${pct.toFixed(1)}%</span>`;
90+
return `<span class="${classes}" title="${from.toFixed(3)} to ${to.toFixed(3)}${delta.toFixed(3)}">${pct.toFixed(1)}%</span>`;
9191
} else {
9292
return `<span title="error" style="color: orange;">-</span>`;
9393
}
@@ -141,12 +141,12 @@ <h3 id="title"></h3>
141141
let table = document.getElementById("primary-table");
142142
let idx = 0;
143143
for (let element of data.profile.query_data) {
144-
let a = to_object(element);
145-
let b = null;
144+
let cur = to_object(element);
145+
let prev = null;
146146
if (data.base_profile) {
147-
for (let b_el of data.base_profile[0]) {
148-
if (to_object(b_el).label == a.label) {
149-
b = to_object(b_el);
147+
for (let prev_el of data.base_profile[0]) {
148+
if (to_object(prev_el).label == cur.label) {
149+
prev = to_object(prev_el);
150150
break;
151151
}
152152
}
@@ -160,31 +160,31 @@ <h3 id="title"></h3>
160160
}
161161
row.appendChild(td);
162162
}
163-
td(row, a.label);
164-
td(row, to_seconds(a.self_time).toFixed(3));
165-
if (b) {
166-
td(row, fmt_delta(to_seconds(b.self_time), to_seconds(a.self_time)), true);
163+
td(row, cur.label);
164+
td(row, to_seconds(cur.self_time).toFixed(3));
165+
if (prev) {
166+
td(row, fmt_delta(to_seconds(prev.self_time), to_seconds(cur.self_time)), true);
167167
} else {
168168
td(row, "-", true);
169169
}
170-
td(row, a.invocation_count);
171-
if (b) {
172-
td(row, fmt_delta(b.invocation_count, a.invocation_count), true);
170+
td(row, cur.invocation_count);
171+
if (prev) {
172+
td(row, fmt_delta(prev.invocation_count, cur.invocation_count), true);
173173
} else {
174174
td(row, "-", true);
175175
}
176-
td(row, a.cache_misses);
177-
if (b) {
178-
td(row, fmt_delta(b.cache_misses, a.cache_misses), true);
176+
td(row, cur.cache_misses);
177+
if (prev) {
178+
td(row, fmt_delta(prev.cache_misses, cur.cache_misses), true);
179179
} else {
180180
td(row, "-", true);
181181
}
182-
td(row, to_seconds(a.incremental_load_time).toFixed(3));
183-
if (b) {
182+
td(row, to_seconds(cur.incremental_load_time).toFixed(3));
183+
if (prev) {
184184
td(row,
185185
fmt_delta(
186-
to_seconds(b.incremental_load_time),
187-
to_seconds(a.incremental_load_time),
186+
to_seconds(prev.incremental_load_time),
187+
to_seconds(cur.incremental_load_time),
188188
),
189189
true);
190190
} else {

0 commit comments

Comments
 (0)