From d41719c5ace4f55b92fdbc20531775abde0e258f Mon Sep 17 00:00:00 2001 From: Florent Tapponnier Date: Thu, 4 Jun 2026 23:02:06 +0200 Subject: [PATCH] fix(bench): Best/Worst headline respects higher_is_better For benches like HL frontends (higher_is_better=true, fees in USD), Best is the max value not the min, and Worst is the min not the max. Latency benches keep the original min=Best mapping. Fixes BEST=$0 / WORST=$24K on staging HL frontends page where the leaders (phantom-perps $119K, metamask $66K) were being mapped to Worst. --- src/app/alternatives/[slug]/page.tsx | 4 +- src/components/benchmark-body.tsx | 58 ++++++++++++++++------------ 2 files changed, 35 insertions(+), 27 deletions(-) diff --git a/src/app/alternatives/[slug]/page.tsx b/src/app/alternatives/[slug]/page.tsx index 1488a209..e95babd9 100644 --- a/src/app/alternatives/[slug]/page.tsx +++ b/src/app/alternatives/[slug]/page.tsx @@ -250,7 +250,7 @@ export default async function AlternativePage({
)} - {!isDraft && benchmark.unit !== "count" && ( -
- - - - 0 ? `${tailSpread.toFixed(1)}×` : "-"} - hint={ - tailSpread > 0 - ? `${fmtUnit(tailMin, benchmark.unit)} → ${fmtUnit(tailMax, benchmark.unit)}` - : undefined - } - /> -
- )} + {!isDraft && benchmark.unit !== "count" && (() => { + // For higher-is-better benches (e.g. HL frontends USD revenue), the + // "best" headline is the max value, not the min. Latency benches keep + // the original min=best mapping. + const higherIsBetter = benchmark.higherIsBetter === true; + const bestValue = higherIsBetter ? fieldMax : fieldMin; + const worstValue = higherIsBetter ? fieldMin : fieldMax; + return ( +
+ + + + 0 ? `${tailSpread.toFixed(1)}×` : "-"} + hint={ + tailSpread > 0 + ? `${fmtUnit(tailMin, benchmark.unit)} → ${fmtUnit(tailMax, benchmark.unit)}` + : undefined + } + /> +
+ ); + })()} {!isDraft && ( <>