Owyn / HandyImage

browser userscript (extension) which Shows just fullsize Image with hotkeys & without pop-ups on many image-hosting sites
https://greasyfork.org/scripts/109-handy-image
273 stars 58 forks source link

high cpu usage with big gif fav icons ? #448

Closed rezad1393 closed 3 years ago

rezad1393 commented 3 years ago

this is adult picture site, so be warned.

https://jerking.empornium.ph/image/7ehH

on my main firefox profile with 20 tabs opened opening these with handyiamge installed in violetmonkey addon in firefox. switching to and from these tabs takes time and firefox cpu usage goes very high with them.

I tested with a empty firefox profile and installed violetmonkey and handyimage with only these duplicated of theses address in tabs opened. it still has high cpu usage and user noticeable delay in tab switching.

opening the gif image directly doesn't have this issue but it also doesn't use animated fav icon. your script (or firefox with your script) loaded the whole gif file as a fav icon the first time you switch to the tab (before that it is a static icon) this can be seen in browser console, just open the image link in a new tab but don't switch to it and wait for image to load then switch to the tab and see the get http request for gif again and fav icon in the tab get changed to gif. the gif is 4MB so I can t fault firefox for getting high cpu for trying to downscale that image to tab icon.

I think this is a firefox bug but if you could disable fav icon loading for this script it would help a lot in mean time.

rezad1393 commented 3 years ago

update : brave doesnt try to load a gif icon for this issue. so firefox tried to load that gif. can you still disable this or is this out of your hands?

Owyn commented 3 years ago

Yea, it lags for my firefox too... I could just not make favicons for gif types, would that be allright?

rezad1393 commented 3 years ago

Yea, it lags for my firefox too... I could just not make favicons for gif types, would that be allright?

I don't understand your sentence in complete. but if you mean you could make that firefox too like brave would not replace the fav ico with the gif, then yes that is what I am asking.

though as firefox does and brave doesnt do this this may not just be your script.

Owyn commented 3 years ago

Yes, firefox having animated images in favicon causes lag, my script can just check if favicon is a "gif" and remove the favicon

rezad1393 commented 3 years ago

Yes, firefox having animated images in favicon causes lag, my script can just check if favicon is a "gif" and remove the favicon

thanks. so this is a firefox bug cause that is also caused because other browsers dont load this specific fav icon.

I have seen bug about fav icon animated bug in firefox from firefox 19 but I think there is something different between firefox and brave (chrome) in that brave doesnt even load this gif as a fav icon but firefox does.

again thanks for fast answer. also if you can remove all the fav icon when using this script that would help more so , because I (or others) aren't interested in fav icon of screenshots too. they are useless because they don't add any info (you can see them that small) but they load network and more importantly memory resources.

so if you could remove fav icon (that replaces the website fav icon) for all, I think that would make this script better.

Owyn commented 3 years ago

they are useless because they don't add any info (you can see them that small)

if one screen is mostly red and other is mostly green you'd be easily able to tell them apart from favicons tho as for network - browsers shouldn't download the one same exact image twice

rezad1393 commented 3 years ago

they are useless because they don't add any info (you can see them that small)

if one screen is mostly red and other is mostly green you'd be easily able to tell them apart from favicons tho as for network - browsers shouldn't download the one same exact image twice

yes I understand. it was just a suggestion that I think would make this script better. but to be honest the example of one mostly red and one mostly green wouldn't actually need this script :))

I mean that if you compare two movie screenshots then the fav icon of them is useless and you cant tell them apart. maybe in a portrait ( and the one with only face with no shoulder) it would to an extent be different enough but it is still not useful.

but in the end this is your script and you should do as you think is best. I just think this makes is lighter and better and wont entangle it in browser fav icon bugs.

Owyn commented 3 years ago

pro tip: there's options page for the script, there you can use your own javascript for any kind of customization of functional,

for example - removing the favicon custom JS action:

var link = document.head.querySelector("link[rel*='icon']"); 
link.remove();
Owyn commented 3 years ago

new version https://github.com/Owyn/HandyImage/commit/cb522aa09da6033d8a752166954c078ac03b89c1 should remove gif favicons

rezad1393 commented 3 years ago

pro tip: there's options page for the script, there you can use your own javascript for any kind of customization of functional,

for example - removing the favicon custom JS action:

var link = document.head.querySelector("link[rel*='icon']"); 
link.remove();

I used your script but this still replaces the icon https://jerking.empornium.ph/image/EBNW

rezad1393 commented 3 years ago

please reopen this. reproduced the issue with non-gif big file fav icon. https://fapping.empornium.sx/image/dT4k

Owyn commented 3 years ago

all your images don't open image

this still replaces the icon

if it's not a gif icon then that's intended

what about this image? it's ~10MB but it doesn't lag in my firefo: https://www.imagebam.com/view/ME3C17S

rezad1393 commented 3 years ago

they open fine for me in both firefox and brave. the image is 2MB. and it lags the firefox because in firefox the images get loaded as fav icon after switching to that tab. also you can try to open more than one tab to see the effect better. trust me this is the same as that gif issue. I think the gif was not the issue but the size.

please please add and option to no load the icon.

Owyn commented 3 years ago

does the script to remove icon not work?

rezad1393 commented 3 years ago

no it doesnt. I have set the script not to open the image directly because it would cause some images to download instead of viewing them in browser. maybe I shoud just set that because that would remove all the icons. also the imagebam example that you sent doesnt replaces the icon for me.

but if you add remove icon option that would be great.

Owyn commented 3 years ago

it seems you are right, the feature of favicon is indeed quite needy and brings little value

just tested two images https://radikal.ru/lfp/c.radikal.ru/c10/2106/5e/4b8b0f0ee6af.png/htm & https://radikal.ru/lfp/a.radikal.ru/a32/2106/32/6267fd35158e.png/htm and switching between these two tabs is noticeably delayed with high cpu usage

gonna fully remove picture favicon for now

rezad1393 commented 3 years ago

it seems you are right, the feature of favicon is indeed quite needy and brings little value

just tested two images https://radikal.ru/lfp/c.radikal.ru/c10/2106/5e/4b8b0f0ee6af.png/htm & https://radikal.ru/lfp/a.radikal.ru/a32/2106/32/6267fd35158e.png/htm and switching between these two tabs is noticeably delayed with high cpu usage

gonna fully remove picture favicon for now

it seems that you have grasped the infinite knowledge of you lord and savior (me). /s

thanks.