Skip to content

perf: inherit editorial on filtered variants (drops 75% Prom load per page) - #188

Merged
Flotapponnier merged 1 commit into
devfrom
fix/inherit-editorial-from-aggregate
May 29, 2026
Merged

perf: inherit editorial on filtered variants (drops 75% Prom load per page)#188
Flotapponnier merged 1 commit into
devfrom
fix/inherit-editorial-from-aggregate

Conversation

@Flotapponnier

Copy link
Copy Markdown
Collaborator

Likely cause of the 'almost always draft on staging' navigation perception. PR #182 made every filtered variant run per-chain Prom fan-out (3 extra queries each) so chain-aware placeholders could resolve. With 9 pre-fetched variants per bench, that quadrupled the cold-cache Prom load.

Editorial copy (findings, faq, seoIntro, etc.) is the SAME on every tab — only chart data legitimately differs by filter. So filtered variants don't need their own per-chain compute. They inherit editorial + per-chain stash from the aggregate at the page level instead.

  • spec.ts: re-add !isFiltered guard on the per-chain block. Filtered variants don't do the extra Prom queries anymore.
  • benchmarks/[slug]/page.tsx: when building the variants map, splice the aggregate's findings/faq/seoIntro/abstract/methodology/perChainExplainer + bestPerChain/worstPerChain onto each variant. The variant keeps its own chart data + leaderboard.

Net: page cold-start drops from 36 query sets to 9 on a 3-chain bench, while chain-aware placeholders stay resolved on every tab.

…ting

PR #182 made every filtered variant run the per-chain Prom fan-out so {{best_name:chain:X}} could resolve in the variant's findings/faq/seoIntro. That quadrupled cold-cache Prom load per page (3 extra queries × 9 pre-fetched variants on benches like aggregator-head-lag), making cold-start visibly sluggish on Vercel preview URLs and pushing some bench loads close to the function timeout.

Cleaner: editorial copy is the same on every tab (it's the same YAML), so filtered variants don't need their own per-chain compute. They inherit findings / faq / seoIntro / abstract / methodology / perChainExplainer / bestPerChain / worstPerChain from the aggregate at the page-level fetch. Per-chain compute stays on the unfiltered hub only.

Net effect: page cold-start drops from 36 query sets to 9, while keeping all the chain-aware placeholders correctly resolved on every tab.
@Flotapponnier
Flotapponnier merged commit aa2436a into dev May 29, 2026
@Flotapponnier
Flotapponnier deleted the fix/inherit-editorial-from-aggregate branch June 9, 2026 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant