staticSearch icon indicating copy to clipboard operation
staticSearch copied to clipboard

Consider adding preload headers to the search page

Open joeytakeda opened this issue 3 years ago • 2 comments

While the search page is already quite fast, we could make it even faster by using the preload hint for browsers:

https://developer.mozilla.org/en-US/docs/Web/HTML/Preloading_content

When we build the search page, we could add preloads for the required set of resources so that by the time the JS kicks in, those resources would be cached and staticSearch could instantiate a bit faster.

It looks like all major browsers have supported it for a while (https://caniuse.com/link-rel-preload) and I can't imagine there being any major downsides, but we'd need to test, of course.

joeytakeda avatar Apr 01 '21 00:04 joeytakeda

I'm going to bump this to blue sky—it's purely an enhancement that could be interesting (but is not at all necessary).

joeytakeda avatar Oct 03 '21 01:10 joeytakeda

I agree it's blue sky, but when there's time I'd definitely like to try it and see whether it makes any difference. The tricky bit is figuring out whether it'll interfere with requests for the same resources made using fetch(); if we don't explicitly fetch things, we won't know when they're available, but if we initiate a fetch request while the browser is already getting the resource as a preload, we'll be depending on the browser being clever enough to notice that and optimize around the conflict.

martindholmes avatar Oct 03 '21 03:10 martindholmes