On this, I wrote an article before I joined Google about how I thought this was a performance game changer, and I always said that sites that are giving up free web performance to the users, making passing the core web titles needlessly toughen themselves with not doing this. Because you get this for free, but there's a couple of APIs that you can use that'll disable this back forward cache, because the browser goes, I'm not sure if it's safe to actually restore back to this page. So if you use cache control no store, or if you use unload handlers on desktop, then it stops it.
There's a very easy test in DevTools in Chrome. Go there into the application tab, go to back forward cache. There's a big, inviting blue button. Load your page, press that, it will go forward, to a random page about .chrome or something like that, and it will come back, and then it will tell you whether that works, and if it didn't work, here's CNN, it will tell you why. These are unload handlers, and you can look at those and see whether they're actually worth the benefit.
And last of all, avoid animations that use layout-inducing CSS properties. This is a bit of a weird one, because I'm not entirely sure that we're doing this right, but it's what we're doing at the moment. So look at this fancy animation. We love animations, we love bringing them in and stuff like that. But if you're using top, left, right, bottom, and you're moving stuff with that in CSS, that's actually really process-intensive for the browser. They've got to relay out everything else, and they've got to have a look and send and shift, and then figure it out and redraw it. That's even if you move it into its own layer, its own Z index, and it's completely separate from the page. It will still have to do that stuff and do that. And these two bits of code are, will be identical to the user, but the one on the right is using transform. That happens in the compositor layer, after all the layer is happening, we just do a little trick right at the end just before we've hit the screen. Much less work for the browser, and also doesn't count towards CLS, because the CLS stuff happens earlier than this. The net effect to the user is mostly the same, so maybe CLS shouldn't measure it, but there's lots of other good reasons we're doing this. So, if you're sitting there and you've got a cookie banner that comes up, make sure you're doing it with transform, not with top left, because otherwise you're getting needlessly hit with that CLS. So, Fade, as I say, you click a button, how long does it take until the JavaScript cart is running? Lots of websites pass this. It's not a really good measure, and that doesn't mean that we're just making it harder, because can we all honestly hand in heart say that lots of websites are fast for, you know, they interact immediately and do that and stuff like that. No. So, we've introduced this new metric last year, Interactions Next Paint, and at Google IOO at the beginning of this month we announced this is going to replace FADE next year. So, there's some search ranking benefits from having faster websites. This will be what we use to measure it. So, FADE, basically, if you start clicking on a button, you've got some blocking time before anything happens. Then you've got the interaction, your JavaScript code running, and then you've got to paint the results of that JavaScript running. FADE measures this bit.
Comments