josh-berry / tab-stash

Firefox extension to save and restore tabs as bookmarks. Clear your tabs, clear your mind.
https://josh-berry.github.io/tab-stash/
Mozilla Public License 2.0
762 stars 45 forks source link

[Feature Request] Disable and/or on-demand reset of cached favicons #492

Open UnfortunateLiama opened 2 months ago

UnfortunateLiama commented 2 months ago

Problem Statement

Lots of open tabs/(stash/regular)bookmarks ; visible impact on performance with extension enabled , e.g. on browser startup and opening the stash page

Preferred Solution(s)

Option to disable any favicon operations , can decrease ram/cpu usage and save disk space not relying on a cache database to fuction . Extension could use a generic icon instead for tabs and stash (Tried to lock the databse with a empty file but that prevents the extension to function properly, unable to collapse open/unstashed tabs section or expand the stash groups , did not try to stash anything though 😄 )

Alternative Solution(s)

Option to disable favicons operations only for the stashed tabs (bookmarks) and able to clear the database on demand, Will still allow caching of favicons for open/unstashed tabs.

Additional Context

Firefox 115.12.0esr (64-bit) Tab Stash 3.0.1


Readers: If you are also interested in seeing this feature be developed, please vote for it by giving the ORIGINAL POST a thumbs-up using the :smiley: button. You are welcome to leave comments and discuss the feature request, but "Me too!" comments are not counted by the voting system.

josh-berry commented 1 month ago

I'd like to better-understand your performance issue:

It's very unlikely that favicons are the cause of any issues on browser startup or page load—they are not loaded at all on browser startup. The only time they are loaded is when the Tab Stash UI is opened, at which point they are loaded in the background after the rest of the UI is ready (so generally will not affect responsiveness).

UnfortunateLiama commented 1 month ago

115.13.0esr (64-bit) ~120000 total bookmarks 💀 places.sqlite 50-70MB ~1000 open tabs(few are pinned tabs) (negligible/not much difference on browser startup or opening the stash page delay with stash-list as only tab) ~1000 in tab stash , 3x groups , a couple deleted stashed bookmarks

Not the best choice of words , by that i mean the delay it takes for firefox to enter "idle" after startup with the extension enabled, theres no impact on browsing Theres also the same delay when opening the stash-list even if closed and reopened RAM usage after browser startup wihout having stash-list (no yet for the session) open, the extension uses about 1xxMB (~10MB less with no session) and goes up when the stash-list is open 3xxMB

The large places.sqlite is the cause as the delay does happen with other bookmark related extensions aswell when opening their internal pages Well the main reason for the feature request is to be able to keep the fsanvoic.sqlite from growing to large and have a user friendly way to reset it , the opposite of fetch (missing) icons; It also seems that the database is modified when opening a new tab (stash list makes no difference if it was open or not)

josh-berry commented 1 month ago

~120000 total bookmarks 💀 places.sqlite 50-70MB

120k bookmarks is going to be the reason for the slow startup/loading times. Currently Tab Stash loads the entire bookmarks database into memory when your browser starts, and also when opening the Tab Stash UI (which cannot share its data with the background page, unfortunately). It does this because that's how we keep up to date with folders/sub-trees being moved/deleted, etc. especially things being moved into and out of the stash.

There are more intelligent ways to do this, I just haven't had time to implement them yet. (That work will be done as part of #97.)

It also seems that the database is modified when opening a new tab (stash list makes no difference if it was open or not)

Yes, right now we cache favicons for open tabs, so that if you stash that tab, we can keep its icon. This cache is cleared of stale things periodically, but if you have an open tab or saved bookmark, that's enough to keep an icon in the cache.

But, again, this is unlikely to be the cause of responsiveness issues on browser startup or on loading the Tab Stash UI. You could have millions of icons in there and the worst case would be wasted space—they're added to the cache eagerly, but only loaded on demand (e.g. opening the UI), and even then in the background.