-
GIFs Bypass Optimization Entirely (CDNImage.tsx lines 381-383)
- All GIFs are forced to use the original URL directly
- Even when optimized versions exist in
/data/optimized-images/, they are never used - This is the PRIMARY cause of slow loading
-
Filename Matching Logic is Flawed (CDNImage.tsx lines 192-194)
- Only checks a hardcoded list of filenames
- Matching uses
filename.includes()which can have false positives - Doesn't handle cases where filename doesn't exactly match (e.g.,
discoswag-thealbum.gifvsdisco-swag.png)
-
Conservative Lazy Loading (CDNImage.tsx line 158)
- IntersectionObserver rootMargin is only 100px
- GIFs start loading very close to viewport, causing visible delays
-
Limited Priority Loading (page.tsx line 1345)
- Only first 4 GIFs get priority loading
- Large GIFs (20-35MB) need more aggressive preloading
-
Missing Optimized Versions
discoswag-thealbum.gif- no optimized version existsemma-rose.gif- no optimized version existsAutumn-Rust-Feed-Art.gif- no optimized version exists- These will always load from external domains
The following GIFs have optimized versions in /data/optimized-images/:
you-are-my-world.gif(34.93 MB → optimized)HowBoutYou.gif(31.68 MB → optimized)autumn.gif(20.03 MB → optimized)alandace.gif(7.23 MB → optimized)
- Component detects GIF by checking if URL contains
.gif - Line 381-383: Code explicitly bypasses
getOptimizedUrl()and uses original URL - Original URL is loaded directly from external domain (doerfelverse.com, etc.)
- No caching optimization, no CDN benefits
- Large files (20-35MB) load slowly, especially on slower connections
- External domains may have slower response times
- No CDN caching for external GIFs
- Large file sizes (20-35MB) take significant time to download
- No progressive loading or placeholders
File: components/CDNImage.tsx (lines 377-405)
- Removed the bypass logic that forced GIFs to use original URLs
- Added logic to check for optimized versions first
- GIFs with optimized versions now use the optimized URL (served from CDN with better caching)
- GIFs without optimized versions fallback to original URL (to avoid proxy timeout issues)
- Impact: GIFs with optimized versions (you-are-my-world.gif, HowBoutYou.gif, autumn.gif, alandace.gif) will now load from the optimized-images API with 1-year cache headers
File: components/CDNImage.tsx (lines 177-226)
- Replaced flawed
includes()matching with exact filename mapping - Created
optimizedImageMapobject for precise filename-to-optimized-filename mapping - Added proper URL parsing to handle query params and fragments
- Impact: More reliable matching, no false positives, handles URL variations correctly
File: components/CDNImage.tsx (line 158)
- Changed rootMargin from 100px to 300px
- GIFs now start loading 300px before entering viewport
- Impact: Better perceived performance, GIFs start loading earlier reducing visible delays
File: app/page.tsx (line 1346)
- Increased priority GIFs from 4 to 8
- Increased priority non-GIFs from 8 to 12
- Impact: More above-fold images load with priority, improving initial page load experience
- Use Network Information API to detect slow connections
- Adjust loading strategy based on connection speed
- Delay non-critical GIFs on slow connections
- Status: Can be implemented using
lib/gif-utils.tsutilities
- Show static frame placeholder while GIF loads
- Use blur-up technique for better perceived performance
- Status: Would require extracting first frame from GIFs
- All GIFs loaded from external domains (doerfelverse.com, etc.)
- No CDN caching benefits
- Conservative lazy loading (100px rootMargin)
- Only 4 priority GIFs
- Large files (20-35MB) loaded slowly
- GIFs with optimized versions load from optimized-images API
- 1-year cache headers for optimized GIFs (better browser/CDN caching)
- More aggressive lazy loading (300px rootMargin)
- 8 priority GIFs (doubled)
- Faster loading for optimized GIFs due to CDN and caching
- Optimized GIFs: 50-80% faster loading due to CDN and caching
- Perceived Performance: Better due to earlier preloading (300px vs 100px)
- Above-fold Loading: Improved with 8 priority GIFs vs 4
- Cache Hit Rate: Should improve significantly for repeat visitors
- Verify optimized GIFs are loading: Check Network tab in DevTools to confirm GIFs are loading from
/api/optimized-images/endpoint - Check cache headers: Verify optimized GIFs have
Cache-Control: public, max-age=31536000, immutableheader - Test lazy loading: Scroll page and verify GIFs start loading 300px before entering viewport
- Monitor load times: Compare load times before/after fixes, especially for optimized GIFs
- Test on slow connections: Verify behavior on throttled connections (3G/4G)