Skip to content

perf: LCP optimization - avatar, async CSS, deferred scripts#29

Merged
mrlesmithjr merged 2 commits into
mainfrom
develop
Jan 5, 2026
Merged

perf: LCP optimization - avatar, async CSS, deferred scripts#29
mrlesmithjr merged 2 commits into
mainfrom
develop

Conversation

@mrlesmithjr
Copy link
Copy Markdown
Member

Summary

Addresses the 4.4s LCP (Large Contentful Paint) issue identified in Cloudflare Web Analytics (Dec 28 - Jan 3). Google's "good" threshold is 2.5s.

Changes

  • Avatar optimization: Resized from 1536×2048 (393KB) to 300×300 (28KB) - 93% reduction. This is the LCP element displayed at max 110px.
  • Async Font Awesome: Changed from render-blocking to async load via media="print" technique
  • Deferred search scripts: Added defer to lunr.js scripts to prevent blocking initial render
  • Preconnect hints: Added for cdn.jsdelivr.net, disqus.com, and googletagmanager.com

Expected Results

Metric Before After (Expected)
LCP 4,424ms ~2,500-3,100ms
Avatar size 393KB 28KB

Test Plan

  • Verify site loads correctly after deployment
  • Confirm avatar displays properly (check for visual quality)
  • Test search functionality still works
  • Monitor Cloudflare Web Analytics next week for LCP improvement
  • Run Lighthouse audit post-deployment

Resize avatar.jpeg from 1536x2048 to 300x300 (appropriate for 110px
display size with retina support). This is the LCP element and was
causing 4.4s LCP times.

Expected LCP improvement: 500-700ms
- Load Font Awesome CSS async via media="print" trick to prevent
  render blocking (expected: -400-600ms LCP)
- Defer lunr.js search scripts to avoid blocking initial render
  (expected: -300-400ms LCP)
- Add preconnect hints for cdn.jsdelivr.net, disqus.com, and
  googletagmanager.com to reduce connection latency (expected: -100-200ms)

Combined with avatar optimization, total expected LCP improvement:
~1,300-1,900ms (from 4.4s to ~2.5-3.1s)
@mrlesmithjr mrlesmithjr merged commit e45cfe0 into main Jan 5, 2026
1 check passed
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