4 ms·
I've been experimenting and exploring a few ways to implement this for my own browser [1]. The options seem to be: - Great Suspender style suspension [2] - sw
by parhamn 5y ago
I've been experimenting and exploring a few ways to implement this for my own browser [1].
The options seem to be:
- Great Suspender style suspension [2] - swap page with a simple low memory placeholder and reload back (detecting interactions)
- Chrome/FF style tab discarding (only happens with memory pressure) [this post and 3]
- Optimistic unloading with screenshots (this is what we're experimenting with) - we suspend the tab and replace it with a screenshot of the tab before it was suspended, you trigger a reload if you need it. It seems that the screenshot gives you access to the information you cared about while being easy to unload and reload from memory and making it much less likely you actually trigger a reload.
One final one I've been thinking about that I haven't gotten around to testing yet for fast-fan-syndrome (and non-memory limited systems) is to just use renice/cputhrottle (in macOS for example) to force CPU share limits on the processes. This has portability issues and requires certain privileges which is why I'm hesitant to try it immediately.
These obviously have their issues like stopping the JS VM when there might be long running thing that was actually desired (usually prevented with a whitelist).
Happy to test any other ways you think might work!
[1] https://synth.app https://synth.app
[2] https://chrome.google.com/webstore/detail/the-great-suspender/jaekigmcljkkalnicnjoafgfjoefkpeg?hl=en https://chrome.google.com/webstore/detail/the-great-suspende...
[3] https://developers.google.com/web/updates/2015/09/tab-discarding https://developers.google.com/web/updates/2015/09/tab-discar...
- nvrspyx 5y agoWhy not cache the HTML/CSS instead of using a screenshot? I'm no expert on web/browser development, so I don't know the difficulty or feasibility in caching just the visible bits leaving a static HTML/CSS snapshot minus any javascript seems, but it seems more ideal IMO since you'd still be able to click links. Just a thought
- parhamn 5y agoGood Q! It is something we are looking at/trying. It's a bit more complex as you have to have a pool of suspended renderers to swap the html into as the user switches tabs (the HTML still needs to be properly sandboxed). Then you include static asset loads, etc it becomes less 'instant'.
- mgrandl 5y agoScreenshots probably would look pretty goofy if the user resized the window between tab unload and reload.
- dredmorbius 5y agohttps://news.ycombinator.com/item?id=28768413 https://news.ycombinator.com/item?id=28768413