• Resolved chrishechler

    (@chrishechler)


    Hi, sounds like a cool performance improvement for WordPress websites.

    However I am a bit sceptical, in the description it says the plugin”prerender WordPress frontend URLs when the user hovers over a relevant link”. So, does it pre-render the same URL again and agian each time I hover over the relevant link?

    To be more precise, some pages have links that will lead to the same destination URL, so will each link then be pre-render the same final URL or does the plugin recognize that the destination is the same and only pre-renders the page once?

    Thanks, really appreciate any input on this one ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support tunetheweb

    (@tunetheweb)

    Hi Chris,

    If the link is to the exact same page, then no it won’t prerender the page again but is smart enough to recognise this as the same.

    If it has different query params, then it will treat those as different pages as it can’t know whether the page is the same or different. If those query params aren’t important to the rendering of the page (e.g. UTM pages), then we are working on ways for sites owners to let the browser know those query params don’t matter and can be treated as the same page (this already is available for prefetch but not for prerender).

    Speculation Rules will also keep up to two prerendered links in memory at a time, to reduce the memory impact of this feature.

    So, if you hover over link1, then link2, then link3, then link1 again it will prerender links 1, then 1+2, then 2+3 (evicting link 1), then re-prerender link 3 (evicting link 2) so you have links 2+3 prerendered.

    But, even with this, there’s a few things to keep in mind:

    • The user must hover over a link for 200ms so just randomly scanning past a link will not initiate the prerender.
    • If you have concerns about this, then you can change the setting from the default “moderate” eagerness setting to “conservative” so prerendering only triggers on mouse/pointer down. This will trigger a lot less, but at the cost of having a smaller lead time (so not as much performance gain as the page may not be fully prerendered by the time the user finishes the “click” and navigates to the page). See this recent tweet.
    • If still concerned then can also choose prefetch over prerender. However, with WordPress sites without HTTP Caching (that I’ll cover next) this is often nearly as costly as a full prerender.
    • Speculation Rules will make use of the HTTP cache. So if you prerender link1 then any cacheable resources (with cache-control headers) will be stored in the HTTP cache. Then if you prerender link1 a second time, the resources can be read from the cache and the cost to prerender the second time is much reduced (basically memory and CPU costs but no—or at least much reduced—network and server costs). A word of warning here is that many sites (including many WordPress sites) set the HTML to be uncacheable so you may have to refetch the document in this case. ?? It’s recommended to set even a small cache time for performance anyway and that would avoid this.

    Hope that answers all your questions here but let us know if you have any more questions.

    We’ve thought long and hard about trying to reduce the cost of speculation as much as possible and make this feature as easy as possible for most sites to use without having to be too concerned about that.

    Thread Starter chrishechler

    (@chrishechler)

    Wow, thanks for the in-depth answer, really appreciate it ??

    May I just ask if this pre-render could then be an option for websites made with Buddypress or Buddyboss, where potentially hundreds of concurrent users are online? Or will that be too ressource heavy on the server then when several hundred pre-rendered pages are kept in memory at a time?

    Just to explain, Buddyboss websites are generally on the slower side as they can be quite ressource heavy (many requests, concurrency etc) so anyhting that helps boost performance is seen as sth. wonderful ??

    Plugin Support tunetheweb

    (@tunetheweb)

    So the prerendered pages are kept in the browser memory not that server memory.

    I’m not familiar with Buddypress or Buddyboss to be honest but if they have allow HTTP caching and have concerns on the server side then adding a CDN like Cloudflare in front would allow similar requests to be stored at the CDN and then served to thousands or millions of users without hitting the server again and again. Looks like they recommend that too from a quick Google: https://www.buddyboss.com/tutorials/content-delivery-network/

    In that case Speculative loading will help prime the CDN cache but your server wont be overwhelmed. Best of both worlds!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Potential pre-render multiple times?’ is closed to new replies.