-
Notifications
You must be signed in to change notification settings - Fork 176
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
Global plugins cause significant CPU usage #1275
Comments
@GrosPoulet You added this plugin ("niconico_a.js") - does it have to be a global plugin, can it be scoped to a smaller subset of sites? |
Improvement for plug-in: niconico_a (#1275)
@williamvds @extesy #1276 should improve things. |
@williamvds Can you please confirm if this is still a problem in version |
Is there a way to identify global plugins from the hoverzoom+ UI, in order to deactivate them in one go? |
@thunfischbrot I had to disable them with some javascript in the console while on the settings page (for me that's moz-extension://effe954f-ff0e-4b40-bc2c-4dda6eff4348/html/options.html) Array.from(document.querySelectorAll('input[type="checkbox"][id*="_a"]')).forEach(e => $(e).trigger('gumby.uncheck')) |
Describe the bug
Global plugins cause significant CPU usage when loading pages with lots of matched elements, particularly
<a>
links.This appears to be due to matching elements overzealously with loose patterns.
To Reproduce
Enable hoverzoom with all global plugins
Visit a site with a lot of elements, e.g. https://nix-community.github.io/home-manager/options.xhtml
Observe slowdowns, and probably a warning from your browser about hoverzoom slowing down the page
Expected behavior
Loading large pages with hoverzoom enabled does not slow down the browser.
Screenshots
I profiled the page linked above on Firefox, with all the hoverzoom plugins enabled:
Profiling results with all plugins enabled
I then disabled most of the global plugins I could find, particularly the most expensive ones in the above image. Profiling again, I see lower CPU usage, but the enabled plugins now appear to run twice?
Profiling results with some global plugins disabled
Desktop (please complete the following information):
Additional context
The profiling suggests the JQuery selectors are the most expensive part of processing.
E.g. the most expensive matcher here
hoverzoom/plugins/niconico_a.js
Line 24 in acccb87
Is performing fuzzy matching on every link and image on every page.
Could these be prefix matchers instead, e.g.
img[src^="https://lohas.nicoseiga.jp/thumb/"]
? I couldn't quite work out what the URL should be for niconico, comments in the plugin suggest you need an account to view some pages.Would
document.querySelectorAll
be faster than JQuery?The text was updated successfully, but these errors were encountered: