|
| 1 | +# Performance Score Improvement Plan |
| 2 | + |
| 3 | +## Current Lighthouse Scores |
| 4 | + |
| 5 | +| Metric | Score | Issue | |
| 6 | +|--------|-------|-------| |
| 7 | +| **Performance** | 83 | Good but can improve | |
| 8 | +| **Accessibility** | 96 | Good | |
| 9 | +| **Best Practices** | 100 | Excellent | |
| 10 | +| **SEO** | 100 | Excellent | |
| 11 | +| **CLS** | 0.004 | Excellent | |
| 12 | +| **TBT** | ~920ms | High - needs reduction | |
| 13 | +| **LCP** | ~2.9s | Slow - external scripts | |
| 14 | +| **FCP** | ~2.0s | Slow - external scripts | |
| 15 | + |
| 16 | +--- |
| 17 | + |
| 18 | +## Issues & Solutions |
| 19 | + |
| 20 | +### 1. Cache TTL (Est savings: 95 KiB) ✅ ALREADY DONE |
| 21 | +- Current: JS=10m, CSS=10m, Fonts=1d |
| 22 | +- The cache headers (10m) are already good |
| 23 | +- No action needed - GitHub Pages handles this |
| 24 | + |
| 25 | +--- |
| 26 | + |
| 27 | +### 2. Forced Reflow (Total: ~200ms) |
| 28 | + |
| 29 | +**Culprit:** |
| 30 | +``` |
| 31 | +/bundle.js:801:171 → 7ms |
| 32 | +/bundle.js:800:261 → 7ms |
| 33 | +[unattributed] → 180ms |
| 34 | +``` |
| 35 | + |
| 36 | +**Solution:** |
| 37 | +- Check `src/main.ts` line ~130 - the mousemove listener |
| 38 | +- Already throttled, but check for other geometric property reads |
| 39 | + |
| 40 | +--- |
| 41 | + |
| 42 | +### 3. Minimize Main-Thread Work (2.3s) |
| 43 | + |
| 44 | +**Breakdown:** |
| 45 | +| Category | Time | |
| 46 | +|----------|------| |
| 47 | +| Style & Layout | 1,047ms | |
| 48 | +| Other | 508ms | |
| 49 | +| Rendering | 371ms | |
| 50 | +| Script Evaluation | 195ms | |
| 51 | +| Parse HTML & CSS | 136ms | |
| 52 | +| Script Parsing | 33ms | |
| 53 | + |
| 54 | +**Solution:** |
| 55 | +- Reduce bundle size by code splitting |
| 56 | +- Defer non-critical JS |
| 57 | +- Lazy load collection-only code |
| 58 | + |
| 59 | +--- |
| 60 | + |
| 61 | +### 4. Unused CSS (Est savings: 10.3 KiB) |
| 62 | + |
| 63 | +**Current:** bundle.css = 15.9 KiB with ~10 KiB unused |
| 64 | + |
| 65 | +**Solution:** |
| 66 | +- Identify unused rules in `bundle.2022f922.css` |
| 67 | +- Common culprits: table.css, animations.css, print styles |
| 68 | + |
| 69 | +--- |
| 70 | + |
| 71 | +### 5. LCP/FCP Optimization (~2.0-2.9s) |
| 72 | + |
| 73 | +**Current bottlenecks:** |
| 74 | +| Resource | Load Time | |
| 75 | +|----------|----------| |
| 76 | +| Datastar (CDN) | ~250ms | |
| 77 | +| Main JS | ~100ms | |
| 78 | +| Bundle CSS | ~150ms | |
| 79 | +| Google Fonts | ~150ms | |
| 80 | + |
| 81 | +**Solutions:** |
| 82 | +1. ✅ System fonts in critical CSS - **DONE** |
| 83 | +2. Preload all critical assets - check line 51-52 |
| 84 | +3. Consider inlining Datastar locally |
| 85 | +4. Font display already swap |
| 86 | + |
| 87 | +--- |
| 88 | + |
| 89 | +## Implementation Order (Priority) |
| 90 | + |
| 91 | +| Priority | Issue | Expected Impact | |
| 92 | +|----------|-------|----------------| |
| 93 | +| **1** | Check forced reflows | TBT -100ms | |
| 94 | +| **2** | Fix unused CSS | Bundle -10 KiB | |
| 95 | +| **3** | Inline critical JS | LCP/FCP -0.3s | |
| 96 | +| **4** | Code split | Bundle -20 KiB | |
| 97 | + |
| 98 | +--- |
| 99 | + |
| 100 | +## Files to Verify |
| 101 | + |
| 102 | +### Check Forced Reflow |
| 103 | +```bash |
| 104 | +# In src/main.ts - mousemove throttling already done |
| 105 | +# Check src/render/table.ts for getBoundingClientRect |
| 106 | +``` |
| 107 | + |
| 108 | +### Check Unused CSS |
| 109 | +```bash |
| 110 | +# Run with Chrome DevTools Coverage |
| 111 | +# Purge unused CSS with build tool |
| 112 | +``` |
| 113 | + |
| 114 | +--- |
| 115 | + |
| 116 | +## Completed Optimizations |
| 117 | + |
| 118 | +- [x] CLS: 0.534 → 0.004 (fixed min-height) |
| 119 | +- [x] SEO: 50 → 100 (JSON-LD schema) |
| 120 | +- [x] FCP spinner: Added fixed overlay |
| 121 | +- [x] System fonts: In critical CSS |
| 122 | +- [x] DNS prefetch: Added for CDNs |
| 123 | + |
| 124 | +--- |
| 125 | + |
| 126 | +## Next Steps |
| 127 | + |
| 128 | +1. Run Lighthouse to get baseline scores |
| 129 | +2. Audit bundle.js for dead code |
| 130 | +3. Consider inlining Datastar |
| 131 | +4. Split bundle by route (grid vs collection) |
| 132 | + |
| 133 | +--- |
| 134 | + |
| 135 | +*Last Updated: April 2026* |
0 commit comments