Performance Optimization Quick Reference
๐ Quick Stats
Lighthouse Score: 58 โ 94 (+62%)
Time to Interactive: 8.2s โ 2.5s (-69%)
JavaScript Payload: 353 KiB โ 128 KiB (-64%)
Total Savings: 225 KiB unused JS + 536 KiB cache + 383 KiB images
๐ 8 Optimization Phases
| # | Phase | Key Change | Savings | File |
|---|---|---|---|---|
| 1 | Cache | Service Worker, 1-year assets | 536 KiB | CACHE_OPTIMIZATION.md |
| 2 | Render | Critical CSS inline | 1,120ms | RENDER_BLOCKING_OPTIMIZATION.md |
| 3 | Images | Responsive srcset | 383 KiB | IMAGE_OPTIMIZATION.md |
| 4 | Reflow | RAF batching | 31ms | FORCED_REFLOW_OPTIMIZATION.md |
| 5 | Network | Preconnect hints | 2,548ms | NETWORK_DEPENDENCY_OPTIMIZATION.md |
| 6 | JS Exec | Idle loading | 2,585ms | JS_EXECUTION_OPTIMIZATION.md |
| 7 | Main Thread | CSS containment + GPU | 2,470ms | MAIN_THREAD_OPTIMIZATION.md |
| 8 | Unused JS | Preline removal, conditional ads | 225 KiB | UNUSED_JS_OPTIMIZATION.md |
๐ง Key Technical Changes
Service Worker (service-worker.js)
// 1-year cache for static assets
const CACHE_DURATION = 365 * 24 * 60 * 60;
Navigation Handler (_layouts/default.html)
// Replaced 69 KiB Preline with 2 KiB vanilla JS
document.getElementById('menu-toggle').addEventListener('click', () => {
menu.classList.toggle('hidden');
});
Conditional Ads
// Only load on desktop (>768px) with good network
const shouldLoadAds = window.innerWidth >= 768 &&
!navigator.connection?.saveData;
Lottie Lazy Loading
// 25% visibility threshold, 50px rootMargin
new IntersectionObserver(entries => {
if (entry.intersectionRatio >= 0.25) import('lottie-player.mjs');
}, { threshold: 0.25, rootMargin: '50px' });
๐งช Testing Commands
# Local development
bundle exec jekyll serve --watch
# Lighthouse audit
lighthouse http://localhost:4000 --view
# Image optimization
powershell -ExecutionPolicy Bypass -File optimize-images.ps1
# Deploy to GitHub Pages
git add .
git commit -m "Performance optimization"
git push origin main
๐ Performance Budget
| Resource | Budget | Current | Status |
|---|---|---|---|
| JavaScript | 200 KiB | 128 KiB | โ 36% under |
| Images | 500 KiB | 320 KiB | โ 36% under |
| CSS | 100 KiB | 45 KiB | โ 55% under |
| TTI | 3,500ms | 2,520ms | โ 28% under |
| FCP | 1,500ms | 720ms | โ 52% under |
๐ฏ Core Web Vitals Targets
| Metric | Target | Current | Status |
|---|---|---|---|
| FCP | < 1.8s | 0.72s | โ PASS |
| LCP | < 2.5s | 1.28s | โ PASS |
| CLS | < 0.1 | 0.02 | โ PASS |
| TBT | < 300ms | 460ms | โ ๏ธ GOOD |
| TTI | < 3.8s | 2.52s | โ PASS |
๐ Common Issues & Fixes
Issue: Navigation menu not working
Fix: Check vanilla JS navigation handler in default.html lines 357-406
Issue: Images not loading responsively
Fix: Run optimize-images.ps1 to generate image variants
Issue: Lottie animations not loading
Fix: Check Intersection Observer in services.html lines 88-118
Issue: Cache not working
Fix: Clear browser cache, check service worker registration
Issue: Ads not loading on desktop
Fix: Verify width >= 768px, check Network tab for adsbygoogle.js
๐ Modified Files
Core Files (5)
_layouts/default.html- Main optimizations_includes/services.html- Lottie lazy loading_includes/hero.html- Responsive images_includes/projects.html- Responsive imagesservice-worker.js- Caching strategy
Documentation (9)
CACHE_OPTIMIZATION.mdRENDER_BLOCKING_OPTIMIZATION.mdIMAGE_OPTIMIZATION.mdFORCED_REFLOW_OPTIMIZATION.mdNETWORK_DEPENDENCY_OPTIMIZATION.mdJS_EXECUTION_OPTIMIZATION.mdMAIN_THREAD_OPTIMIZATION.mdUNUSED_JS_OPTIMIZATION.mdPERFORMANCE_OPTIMIZATION_SUMMARY.md
๐ Monitoring
Daily
- Check Google Search Console โ Core Web Vitals
- Monitor Lighthouse scores
- Review user engagement metrics
Weekly
- Full Lighthouse audit on all pages
- Check cache hit rates
- Review JavaScript payload size
Monthly
- Compare month-over-month performance
- Analyze user behavior trends
- Check for new optimization opportunities
๐จ Rollback Procedure
# If issues occur, rollback specific phases:
# Rollback Phase 8 (Unused JS)
git revert HEAD~1
# Rollback entire optimization
git checkout <commit-hash-before-optimization>
# Test rollback locally
bundle exec jekyll serve
lighthouse http://localhost:4000 --view
# Deploy rollback
git push origin main --force
๐ Additional Resources
- Full Summary:
PERFORMANCE_OPTIMIZATION_SUMMARY.md - Phase Details: Individual
*_OPTIMIZATION.mdfiles - Web.dev Guides: https://web.dev/performance
- Chrome DevTools: https://developer.chrome.com/docs/devtools
- Lighthouse Docs: https://web.dev/lighthouse
๐ก Future Opportunities
- Code Splitting - Route-based bundles (-50 KiB)
- HTTP/3 - Faster network (-150ms)
- AVIF Images - Better compression (-20%)
- Prefetch - Predictive loading (instant nav)
โ Deployment Checklist
- Run
optimize-images.ps1 - Test locally with
jekyll serve - Run Lighthouse audit (target: 90+)
- Test navigation menu (mobile + desktop)
- Verify images load responsively
- Check Lottie animations
- Confirm ads load on desktop only
- Test on real mobile device
- Git commit with clear message
- Push to GitHub Pages
- Wait 2-3 minutes for build
- Test production site
- Monitor for 24 hours
Status: โ
Production Ready
Last Updated: December 4, 2025
Maintained By: Sulochan Thapa