Skip to content

Improve treasury end date load speedΒ #340

@ECWireless

Description

@ECWireless

πŸ§ͺ Performance Benchmark Report β€” https://explorer.livepeer.org/treasury/

Date: 2025-11-12
Environment: Lighthouse v13.0.1 (mobile emulation, slow-4G, 4Γ— CPU slowdown)
Runs: 3 consecutive


πŸ“Š Median Results (3-run average)

Metric Run 1 Run 2 Run 3 Median β€œGood” Threshold Status
Performance Score β‰ˆ 0.50 β‰ˆ 0.52 β‰ˆ 0.51 β‰ˆ 0.51 β‰₯ 0.90 ⚠️ Needs improvement
First Contentful Paint (FCP) 1.8 s 1.8 s 1.8 s 1.8 s βœ… ≀ 1.8 s βœ… Excellent
Largest Contentful Paint (LCP) 22.0 s 21.9 s 21.9 s β‰ˆ 21.9 s ❌ ≀ 2.5 s 🚨 Severe delay
Speed Index 1.8 s 1.8 s 1.8 s 1.8 s βœ… ≀ 3.0 s βœ… Excellent
Cumulative Layout Shift (CLS) 0.00 0.00 0.00 0.00 βœ… ≀ 0.10 βœ… Excellent
Total Blocking Time (TBT) ~3.2 s ~3.3 s ~3.4 s β‰ˆ 3.3 s ❌ ≀ 0.2 s 🚨 Poor
Time to Interactive (TTI) ~31 s ~32 s ~32 s β‰ˆ 32 s ❌ ≀ 4 s 🚨 Poor
Total Transfer Size ~5.5 MB ~5.4 MB ~5.4 MB β‰ˆ 5.4 MB ❌ < 2 MB 🚨 Heavy

🩺 Diagnosis Summary

βœ… The good

  • FCP and Speed Index are both strong (β‰ˆ 1.8 s) β€” the initial shell paints quickly.
  • CLS = 0 β†’ layout is stable.
  • Server response time is fast and consistent.

⚠️ The bad

  • LCP β‰ˆ 22 s: the main treasury content doesn’t appear until all client-side data and JS finish loading.
  • TBT β‰ˆ 3 s, TTI β‰ˆ 32 s: JS parsing and hydration keep the main thread busy for a long time.
  • JS transfer β‰ˆ 4 MB: excessive bundle weight is the root cause.

🧩 Probable Root Causes

  1. Client-side data fetching β€” treasury values or balances load only after hydration, delaying the largest visible element.
  2. Large client bundle β€” expensive logic or libraries included in the initial route bundle.
  3. Hydration cost β€” the component tree mounts all at once after load.
  4. Third-party scripts β€” analytics or embeds run before interactivity.

πŸ› οΈ Recommended Actions (ordered by impact)

Priority Goal Recommended Actions
1️⃣ Server-render treasury data Show main content instantly β€’ Fetch treasury data via getServerSideProps or ISR (revalidate interval).
β€’ Avoid client-only fetch on initial load.
2️⃣ Reduce JS bundle size Lower TBT / improve responsiveness β€’ Run @next/bundle-analyzer.
β€’ Lazy-load non-critical UI (e.g., secondary tables or wallet logic).
β€’ Convert reusable components to Server Components.
3️⃣ Optimize hydration Lower INP & TTI β€’ Break large components into smaller chunks.
β€’ Use React.startTransition for state updates.
β€’ Memoize expensive effects.
4️⃣ Defer analytics Free up main thread β€’ Load analytics with strategy:"afterInteractive".
5️⃣ Maintain light assets Keep total < 2 MB β€’ Remove unused libraries and polyfills.
β€’ Images are already optimized.

🎯 Target Benchmarks

Metric Current Target Ξ”
LCP 21.9 s ≀ 2.5 s βˆ’89 %
TBT 3.3 s ≀ 0.2 s βˆ’94 %
TTI 32 s ≀ 4 s βˆ’88 %
JS Transfer 4.0 MB ≀ 0.5 MB gz βˆ’88 %
CLS 0.00 ≀ 0.10 Maintain βœ…

Expected result: overall Lighthouse Performance Score β‰ˆ 0.51 β†’ 0.93–0.95 after server-rendering data and slimming the JS bundle.


πŸ“ˆ Additional Steps

  • Move treasury data fetching to the server with ISR or getServerSideProps.
  • Add @vercel/analytics to confirm improvements via field data (LCP/INP/CLS).
  • Run Lighthouse after each major change to track progress.
  • Automate Lighthouse runs in CI for regression detection.

Compiled from 3 Lighthouse v13 mobile runs on 2025-11-12.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions