Closed robinmetral closed 2 years ago
Latest commit: |
872b5ef
|
Status: | β Deploy successful! |
Preview URL: | https://4c3aa1b3.robinmetral.pages.dev |
Tested with WebPageTest on the last post page, to include static assets like images in addition to stylesheet.
Before | After | |
---|---|---|
Optimization overview | Flags uncached static assets | All optimized |
Plotted First Contentful Paint speed | First runs avg. 1000ms, repeat runs avg. 775ms | First runs avg. 1000ms, repeat runs avg. 50ms |
First runs filmstrips | ||
Repeat runs filmstrips | Loads HTML for 700ms | Instand load |
Where the optimizations really shine is on repeat runs through HTML caching. A repeat run used to only cache static assets (for 4h, the Cloudflare default) but the HTML still had to be fetched because Cloudflare defaults to max-age:0
. Caching HTML for 10 min basically means that a page reload load is instant (everything is cached).
Another improvement that isn't shown in tests is performance for a visitor coming back after 4 hours. Unless static, versioned assets have changed, only the HTML will be re-fetched while images and stylesheet will be pulled from the cache (like a repeat run in the "Before" scenario).
Optimize caching:
_headers
: https://developers.cloudflare.com/pages/platform/headers/ (or with a worker)Cache-Control: max-age=31536000, immutable
Cache-Control: max-age=600, must-revalidate
(we don't needprivate
because there's no personalization