youtube / spfjs

A lightweight JS framework for fast navigation and page updates from YouTube
https://youtube.github.io/spfjs/
MIT License
2.24k stars 147 forks source link

In the background, cached/prefetched navigation can be slower than standard navigation #337

Closed nicksay closed 9 years ago

nicksay commented 9 years ago

This particularly affects WebKit browsers: in the background, cached/prefetched navigation can be slower than standard navigation.

When document.visibilityState == 'hidden' (e.g. a background tab or minimized window), cached or prefetched navigation can be slower than standard navigation. For example, if the average responseStart - navigationStart time for background standard navigation is 200ms, then the average background cached/prefetched responseStart - navigationStart time will be 1000ms. This 1000ms delay is very consistent because the spf.nav.request.handleResponseFromCache_ function is executed asynchronously and WebKit forces DOM timers to execute on 1s intervals for hidden documents (see DOMTimer::hiddenPageAlignmentInterval)

TheSisb commented 9 years ago

Sorry to hijack this issue but not sure where else to ask. Really interesting project, just wanted to mention the docs for caching and prefetching have been lacking for some time. Any timeline for when they will get filled in? Really curious to use this in my next project. Thanks

nicksay commented 9 years ago

@TheSisb Thanks for bumping the docs issue. Follow #208 for the caching docs and #210 for the prefetching docs. We'll have something up very soon!