Skip to content

Commit 7a67a4b

Browse files
toschmidtclaude
andcommitted
reweight the combined metric for lukewarm and inapplicable metrics
The Combined score is a weighted geomean of load (10%), data size (10%), cold (20%) and hot (60%) ratios. That unfairly penalizes systems for metrics that don't apply to them, and lets lukewarm "cold" numbers (really warm queries) distort the cold component. Unify the per-metric exclusion rules in a single metricExcludes() helper (stateless from load, in-memory from cold/combined/load, lukewarm from cold, missing data size from size) and reuse it everywhere: - Cold Run metric: lukewarm systems are excluded from the ranking by default. - Combined per-query baseline: the cold-run minimum excludes lukewarm / in-memory systems, so their warm "cold" numbers can't depress the baseline and inflate every true-cold system's cold ratio. min load time / min data size likewise exclude systems that don't qualify. - Combined score: a metric that doesn't apply to a system is dropped and the remaining weights are renormalized, instead of feeding a bogus ratio. Lukewarm systems keep a cold component of 0 with its weight folded into hot (load 10% / size 10% / hot 80%); a stateless engine that still reports a load time (e.g. Polars (Parquet)) drops the load component; etc. The cold term is guarded so an all-lukewarm selection (empty cold baseline) can't poison the score with NaN. The Combined view still shows only the single overall score; the per-component breakdown is added in a follow-up commit. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 5a20e72 commit 7a67a4b

1 file changed

Lines changed: 75 additions & 19 deletions

File tree

index.html

Lines changed: 75 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -926,6 +926,33 @@ <h2>Detailed Comparison</h2>
926926
return 60 + Math.abs(x % 240);
927927
}
928928

929+
/// Whether a system is excluded from a given metric. Single source of truth
930+
/// shared by the top-level metric filter (render) and the per-run baseline
931+
/// used inside the Combined metric (renderSummary) so the two never drift.
932+
function metricExcludes(elem, metric) {
933+
const tags = elem.tags || [];
934+
switch (metric) {
935+
case 'size':
936+
/// Can't rank a system that didn't report a data size.
937+
return !(elem.data_size > 1e9);
938+
case 'load':
939+
/// Needs a real load step: skip trivially-fast loads and
940+
/// stateless / in-memory engines that don't persist data.
941+
return !(elem.load_time >= 5) || tags.includes('stateless') || tags.includes('in-memory');
942+
case 'cold':
943+
/// True cold-cache reads only: in-memory engines have nothing to
944+
/// read from storage, and lukewarm runs never flush engine caches.
945+
return tags.includes('in-memory') || tags.includes('lukewarm-cold-run');
946+
case 'combined':
947+
/// Combined still scores lukewarm systems (with the cold component
948+
/// dropped, see below), but in-memory engines are excluded.
949+
return tags.includes('in-memory');
950+
case 'hot':
951+
default:
952+
return false;
953+
}
954+
}
955+
929956
function renderSummary(filtered_data) {
930957
let table = document.getElementById('summary');
931958
clearElement(table);
@@ -941,10 +968,18 @@ <h2>Detailed Comparison</h2>
941968

942969
const baseline_data = [...filtered_data[0].result.keys()].map(query_num =>
943970
[...Array(3).keys()].map(run_num =>
944-
Math.min(...filtered_data.filter(elem => !elem.fake).map(elem => elem.result[query_num]?.[run_num]).filter(x => x != null))));
945-
946-
const min_load_time = Math.min(...filtered_data.map(elem => elem.load_time).filter(x => x && x > 5));
947-
const min_data_size = Math.min(...filtered_data.map(elem => elem.data_size).filter(x => x && x > 1e9));
971+
Math.min(...filtered_data.filter(elem => !elem.fake)
972+
// Apply the same per-metric exclusions to the baseline that the
973+
// standalone metric uses: run 0 is the cold run, runs 1/2 are
974+
// hot. This keeps lukewarm/in-memory systems out of the cold
975+
// baseline so they can't depress the per-query minimum and
976+
// inflate every true-cold system's cold ratio in Combined. In
977+
// the standalone Cold Run metric they're already filtered out.
978+
.filter(elem => !metricExcludes(elem, run_num === 0 ? 'cold' : 'hot'))
979+
.map(elem => elem.result[query_num]?.[run_num]).filter(x => x != null))));
980+
981+
const min_load_time = Math.min(...filtered_data.filter(elem => !metricExcludes(elem, 'load')).map(elem => elem.load_time));
982+
const min_data_size = Math.min(...filtered_data.filter(elem => !metricExcludes(elem, 'size')).map(elem => elem.data_size));
948983

949984
let summaries;
950985
if (selectors.metric == 'load') {
@@ -957,11 +992,39 @@ <h2>Detailed Comparison</h2>
957992
summaries = filtered_data.map(elem => relativeQueryTime(num_queries, baseline_data, elem, selectors.metric));
958993
document.getElementById('time-or-size').innerText = 'time';
959994
} else if (selectors.metric == 'combined') {
960-
summaries = filtered_data.map(elem => Math.exp(
961-
combined_load_time_share * Math.log(elem.load_time >= 5 ? (elem.load_time / min_load_time) : 1) +
962-
combined_data_size_share * Math.log(elem.data_size >= 1e9 ? (elem.data_size / min_data_size) : 2) +
963-
combined_cold_share * Math.log(relativeQueryTime(num_queries, baseline_data, elem, 'cold')) +
964-
combined_hot_share * Math.log(relativeQueryTime(num_queries, baseline_data, elem, 'hot'))));
995+
summaries = filtered_data.map(elem => {
996+
// Exclude metrics that are not applicable to this system from the combined score,
997+
// and reweight the rest so the final score is still on a similar scale. For example,
998+
// lukewarm systems that don't have a true cold run get their cold weight folded
999+
// into hot, so they can still be compared against true cold systems on the hot
1000+
// performance they do have without being penalized for the cold performance they
1001+
// can't have.
1002+
const exclude_cold = metricExcludes(elem, 'cold');
1003+
const exclude_load = metricExcludes(elem, 'load');
1004+
const exclude_size = metricExcludes(elem, 'size');
1005+
1006+
const hot_share = exclude_cold ? combined_cold_share + combined_hot_share : combined_hot_share;
1007+
let log_sum = hot_share * Math.log(relativeQueryTime(num_queries, baseline_data, elem, 'hot'));
1008+
1009+
if (!exclude_cold) {
1010+
log_sum += combined_cold_share * Math.log(relativeQueryTime(num_queries, baseline_data, elem, 'cold'));
1011+
}
1012+
1013+
if (!exclude_load) {
1014+
log_sum += combined_load_time_share * Math.log(elem.load_time / min_load_time);
1015+
}
1016+
1017+
if (!exclude_size) {
1018+
log_sum += combined_data_size_share * Math.log(elem.data_size / min_data_size);
1019+
}
1020+
1021+
if (exclude_load || exclude_size) {
1022+
const correction = 1 - (exclude_load ? combined_load_time_share : 0) - (exclude_size ? combined_data_size_share : 0);
1023+
log_sum = log_sum / correction;
1024+
}
1025+
1026+
return Math.exp(log_sum);
1027+
});
9651028
document.getElementById('time-or-size').innerText = 'time and data size';
9661029
}
9671030

@@ -1130,16 +1193,9 @@ <h2>Detailed Comparison</h2>
11301193
((selectors.hardware.cpu && (elem.hardware === "cpu" || !elem.hardware)) || (selectors.hardware.gpu && elem.hardware === "gpu"))
11311194
);
11321195

1133-
/// Filter out unreasonable entries
1134-
if (selectors.metric == 'size') {
1135-
filtered_data = filtered_data.filter(elem => elem.data_size);
1136-
}
1137-
if (selectors.metric == 'load') {
1138-
filtered_data = filtered_data.filter(elem => elem.load_time >= 5 && !elem.tags.includes('stateless'));
1139-
}
1140-
if (selectors.metric == 'cold' || selectors.metric == 'combined' || selectors.metric == 'load') {
1141-
filtered_data = filtered_data.filter(elem => !elem.tags.includes('in-memory'));
1142-
}
1196+
/// Filter out entries that can't be ranked under the selected metric
1197+
/// (see metricExcludes for the per-metric rules).
1198+
filtered_data = filtered_data.filter(elem => !metricExcludes(elem, selectors.metric));
11431199

11441200
let nothing_selected_elem = document.getElementById('nothing-selected');
11451201
if (filtered_data.length == 0) {

0 commit comments

Comments
 (0)