Closed cxw42 closed 6 years ago
Does anyone have any data about how well favicons cache? I am wondering if we should either load them on demand or convert them to data URLs and store those in the tree.
Depending how they are stored client-side, how about just obeying the HTTP cache headers if those are available for the favicons? I think they are usually set to very high values _on th. If storage is an issue, expire LRU or whatever...
Edit: if you are discussing how to store it client-side - they are usually highly optimized and small, are there some storage/performance limitations?
So, I had a look at my cached icons and this is what I could see Average 16x16 favicon is under 1KB, and for complex patterns it can go maybe up to ~4KB Average 32x32 favicon is under 4KB, and for complex patterns it can go maybe up to ~6KB Average 64x64 favicon is around 30KB Average 128x128 favicon is around 90KB
Standard favicon is 16x16. could be worth it to convert the larger ones to 16x16 since realistically that's all the space we have for it.
Considering those numbers I would say just stick them in the database along with everything else. for a heavy user we have, say 5KT (Kilotabs :D) @ 3KB average, that is about 15MB on memory. not amazing but honestly not half bad either.
I suppose the really optimised way would be to store them in a separate table and link them. (maybe an upgrade for once the core development is done?) to optimise maybe you could only load tab icons if their parent tree is expanded? that should be plenty good enough.
@bluikko My initial thought behind storing the favicons offline was because I use TabFern offline fairly often. Although, now that I think about it, requiring icons offline when you can't actually access the sites they represent probably doesn't make a lot of sense... ;)
@ShervinM thanks for the data! I agree 16x16 is the right size to store. I think that, to start with, loading from the URLs only when the tree is expanded would be the easiest way to provide some of the functionality at not too much cost.
Found this.
jstree.set_icon
adds an inline background-image
, which will override the CSS background-image
if one is specified. Now I need to remind myself why I am using content
instead of background-image
for .fff-page
and the other icon styles! (Edit No wonder I can't remember: that was very early on, in d8f3a52.)
Either that, or set inline content
rather than inline background-image
.
Also need to check this in Firefox.
In my latest development version (3fcf013), favicons are saving and restoring (from network) correctly! They do not actually get loaded until you expand the tree they are in. It appears that sometimes they are pulled from cache and sometimes they are not. TF is not saving them at this time.
As far as I can tell, if the favicon file doesn't exist (e.g., 404), Chrome never reports it to TabFern as a favicon. Therefore, you get the regular page icon for those pages. However, if a site returns a 200 for the favicon, but invalid data, no icon is shown in the tree (not even the generic one). I can't find a way to check for this short of manually trying to load each saved favicon and see whether valid image content came back, and I would rather not do that if I don't have to :) .
Can you think of any edge cases I should test for? I think this is about ready for release, otherwise. Of course, feedback after release will be welcome (including whether TF should cache favicons offline).
Cases:
Requested by Bruce Huber via support request 2017/11/07:
I've been thinking about that myself since before 7798975. I will take this as an answer to my question :) . Search is #75.
Does anyone have any data about how well favicons cache? I am wondering if we should either load them on demand or convert them to data URLs and store those in the tree.