-
Notifications
You must be signed in to change notification settings - Fork 280
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
Throbber animation slowing page loads by up to 50% #2328
Comments
Related #1384 |
Sadly I have no more good idea to optimize CSS animations... It is beyond my technical skill. |
You could try to use the animation with 30 fps instead of 60 fps by applying the following css: :root:not(.throbber-synchronizing) .tab:not(.collapsed).loading:not(.throbber-unsynchronized) .throbber::before,
:root:not(.throbber-synchronizing).have-loading-tab #master-throbber,
:root.have-loading-tab #sync-throbber,
:root.blocking-throbber #blocking-screen .throbber::before {
animation: throbber 1.05s steps(30) infinite;
} Its the css from line 52 in From some quick testing I didn't notice any slowdown when comparing loading CNN.com with and without Tree Style Tab's sidebar being open. Also Firefox's tab animation seems to be defined here and seems similar to Tree Style Tab's animation. If the performance is still bad when the animation has a really low fps (such as Environment
|
Oops, I didn't mean to close this. I do have saved performance profiles from the sidebar both open and closed if that helps. After I posted this issue, I lowered the steps way down to <10 and noticed a big improvement. I've no idea why it would only affect my (MacOS) system. Maybe something about my setup. I'll do some more investigating. I'm curious though, would an APNG image be better? (It's like Gif but with alpha transparency) I've never worked with with them before but like it could save some cycles. |
Because SVG throbber is required to apply the theme color to the throbber itself. Firefox itself also uses this method maybe due to same reason. Anyway, I've inspired from the idea of @Lej77's comment and I've introduced a new custom property to define the animation steps of the throbber with the commit 72db584. After that you can override the animation steps simply like following: :root {
--throbber-animation-steps: steps(10);
} |
After some thought the performance issue might be because of tricks we do to make the loading animations synchronized. The following CSS should disable the synchronization: /* Apply animation to unsyncronized throbbers */
:root:not(.throbber-synchronizing) .tab:not(.collapsed).loading .throbber::before {
animation: throbber 1.05s steps(60) infinite !important;
}
/* Override the rules that use -moz-element to copy the appearance of the hidden global throbber */
:root:not(.simulate-svg-context-fill) #tabbar .tab:not(.collapsed).loading .throbber::before {
-moz-context-properties: fill;
background: url("/sidebar/styles/throbber.svg") no-repeat !important;
}
:root.simulate-svg-context-fill #tabbar .tab:not(.collapsed).loading .throbber::before {
mask: url("/sidebar/styles/throbber.svg") no-repeat left center / 100% !important;
}
/* Disable hidden global throbbers since they aren't used anymore */
#sync-throbber,
#master-throbber {
animation: none !important;
} |
@m-thomson have you tried any of the workarounds? Do they improve your performance? |
Perhaps relevant is this Firefox bug report from the original 57 release where they switched to 60 FPS SVG animations: https://bugzilla.mozilla.org/show_bug.cgi?id=1406414 Looks like it only affected some specific machines, for an unknown reason. Their solution was to fall back to APNG "when the browser is under schedule pressure". This might not be doable from an extension - at the very least, it seems rather complex. I am unsure if Firefox has changed their solution in the two years since that bug. |
Note that Firefox switched to 30 FPS several months ago: Relevant line in Firefox’s code: So maybe Tree Style Tab should switch to 30 FPS by default too. |
@m-thomson can you try the latest version and see if you can close this item or not? |
@piroor, no updates from the original poster since July 5th. Maybe consider closing this out? |
Short description
I noticed that certain pages load about ~50% faster with the TST sidebar hidden. I was able to trace it back to the page loading throbber.
Steps to reproduce
Expected result
Page load time should not be affected by TST.
Actual result
Pages loaded considerably slower
Environment
Other notes
The text was updated successfully, but these errors were encountered: