Closed Bug 1385618 Opened 7 years ago Closed 7 years ago

Turn Off the Lights does extremely expensive work from its storage callbacks

Categories

(WebExtensions :: General, defect, P3)

54 Branch
defect

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: stefan.vd01, Unassigned)

References

Details

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.78 Safari/537.36 Steps to reproduce: 1. Install the Turn Off the Lights Firefox extension on a new clean Firefox profile from this official website: https://addons.mozilla.org/en-US/firefox/addon/turn-off-the-lights/ or https://www.turnoffthelights.com/firefox.html 2. Leave the both tabs open. 3. When you open then the Turn Off the Lights Options page (from file -> add-on menu) 3. Enable the "autostop" feature (or any other features such as Night Mode) Actual results: You see the all tabs is refreshing and then freeze the Firefox web browser Expected results: No freezing. note: This is a webextensions port from the Turn Off the Lights Chrome extension. And both Google Chrome, Opera doesn't have this issue. Here in Firefox it is a performance issue for our users.
note: I am the developer of the Turn Off the Lights Browser extension
Component: Untriaged → WebExtensions: General
Product: Firefox → Toolkit
Can you give us some details about what the autostop feature does?
Component: WebExtensions: General → WebExtensions: Compatibility
Example you click on the "autostop" checkbox (in the Turn Off the Lights -> Basics tab)
That "autostop" feature, is to stop those automatically playing HTML5 videos. Such as on YouTube.
I don't think its autostop but the saving of the settings to storage.sync. On Windows this causes a large increase in CPU usage. Could one of you investigate, it sounds like something we should prioritise. I was able to reproduce this problem without being logged into FxA.
Flags: needinfo?(lgreco)
Flags: needinfo?(kmaglione+bmo)
Summary: When change a setting in the Turn Off the Lights Firefox extension the Firefox web browser is almost freezing → CPU usage spike from browser.storage
STR: * create a new profile * install turn off the lights * go to options page * click a couple of buttons * watch CPU spike At this point I haven't logged in through FxA or connected up storage.sync. Here's my attempt at doing this and getting some Gecko profiles: https://perfht.ml/2vYsD8X https://perfht.ml/2vYAB1J It seems to be better for me in todays Nightly.
It looks like they're trying to animate their icon, calling setIcon *a lot* of times, very rapidly.
Flags: needinfo?(kmaglione+bmo)
@Kris No, we do not animate the icon. It is a flat icon. However, for each click on the tab we refresh the lamp icon.
Sorry, you're right, the animate() function in the profile confused me. Either way, it comes to the same thing. Every time you change any of your options, your storage observer queries the entire list of tabs, and then individually changes the icon for each of them, which is what's causing the problem.
Summary: CPU usage spike from browser.storage → Turn Off the Lights does extremely expensive work from its storage callbacks
Depends on: 1391099
Depends on: 1391153
Depends on: 1391158
Priority: -- → P3
Depends on: 1391310
Flags: needinfo?(lgreco)
Depends on: 1391405
Depends on: 1391472
Component: WebExtensions: Compatibility → Add-ons
Product: Toolkit → Tech Evangelism
Version: 54 Branch → Firefox 54
Mass-closing bugs that relate to legacy versions of add-ons or are otherwise no longer worth tracking. Please comment if you think this bug should be reopened. Sorry for the bugspam. Made you look, though!
Status: UNCONFIRMED → RESOLVED
Closed: 7 years ago
Resolution: --- → WONTFIX
Component: Add-ons → General
Product: Tech Evangelism → WebExtensions
Version: Firefox 54 → 54 Branch
You need to log in before you can comment on or make changes to this bug.