Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement tabs warmup functionality #1139

Merged
merged 2 commits into from
Jul 28, 2023
Merged

Implement tabs warmup functionality #1139

merged 2 commits into from
Jul 28, 2023

Conversation

emvaized
Copy link
Contributor

@emvaized emvaized commented Jul 28, 2023

After digging in Firefox source code for a while, I found out that it by default does something called "tab warmup" — when user hovers the tab, it kind of preloads it's contents, to make the switch feel faster if user decides to click on it.

Here's the Firefox Source Docs article with more explanation on this feature. Few words from it:

Tab warming allows the browser to proactively render and upload layers to the compositor for tabs that the user is likely to switch to. The simplest example is when a user’s mouse cursor is hovering over a tab. When this occurs, the async tab switcher is told to put that tab into a warming list, and to set its state to STATE_LOADING, even though the user hasn’t yet clicked on it.

Warming a tab queues up a timer to unload background tabs (if no such timer already exists), which will clear out the warmed tab if the user doesn’t eventually click on it. The unload will occur even if the user continues to hover the tab.

Sidebery doesn't do such warmup, which I checked by setting browser.tabs.remote.logSwitchTiming flag in about:configs and hovering over Sidebery tabs. And default tabs panel prints various warmup logs in browser console on hovering tabs.

This PR adds the same functionality in Sidebery using browser.tabs.warmup method, and an option to toggle it in settings. Default value is false just in case — but probably could be true, as native tab panel does it by default.

@mbnuqw
Copy link
Owner

mbnuqw commented Jul 28, 2023

That's actually was in my task list, thank you! I think we don't need settings for it (I'll hide it myself), just make it turned on by default.

@mbnuqw mbnuqw merged commit 8694aba into mbnuqw:v5 Jul 28, 2023
@mbnuqw
Copy link
Owner

mbnuqw commented Jul 28, 2023

Issue: #284

@emvaized
Copy link
Contributor Author

was in my task list

Oh, wow — and I thought I will have to justify including this, as it seemed kind of edgy and unusual :)

@emvaized
Copy link
Contributor Author

emvaized commented Jul 29, 2023

I just figured out that it makes no sense to warmup currently active tab on hover (as it's already active). In such case it would be better to warmup the tab which is about to be activated if user decides to close current tab — or perform the "tab switch" action. However, I'm not sure what method it should use — Tabs.findSuccessorTab(tab).id often returns just 1 for me after browser restart. And I guess, it will anyway won't work with tabFlip() action, as it uses a different approach of checking Sidebery's history of tabs?

@mbnuqw
Copy link
Owner

mbnuqw commented Jul 29, 2023

Yep, the best we can do here is just if (!tab.active) browser.tabs.warmup(tab.id).

Maybe add warmup on switching tabs with mousewheel, but the time required for implementation is not worth the result (at least in my scenarios, I rarely experience slowdown of tab activation).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants