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
Performance: Avoid getComputedStyle (Known performance drag) on Sticky #8780
Comments
Thanks for investigating this! @dzearing or @JasonGore, any thoughts? |
Sticky's current overuse of clientRect calls is a legitimate performance bottleneck. The calls are not currently debounced on 'scroll' (by design) and therefore cause constant browser reflow (purple in the graph below). Sticky also causes a number of reflows on initial render while fetching scrollbar measurements and the like. It also requests rect measurements as part of Here's scrolling down the fixed-header list example on https://developer.microsoft.com/en-us/fabric#/components/scrollablepane. I would advocate that folks who are able to drop IE 11 support use |
To be fare I think all api mentions in Paul's blog should be under review for performance impact. At least have several set of eyes on it to see if there are alternative way. As it try to work around some corner case and ask majority of user to pay the price. |
Because this issue has not had activity for over 150 days, we're automatically closing it for house-keeping purposes. Still require assistance? Please, create a new issue with up-to date details. |
Environment Information
Please provide a reproduction of the bug in a codepen:
Actual behavior:
I notice that a lot of officeUiFabric is using window.getComputedStyle
which is known for the force Render (Top performance --javascript force render for the performance issue.)
Here is from Chrome Developerment Lead (Paul Irish.) blog post. on known force Javascript layout.
https://gist.github.com/paulirish/5d52fb081b3570c81e3a#getcomputedstyle
Especially, It notify the Blink (chrome render engine.) on the other thread,
https://en.wikipedia.org/wiki/Blink_(browser_engine)
Get all pending CSS evaluate, and eval all from the node that you ask for all the way to find out all possible className might impacted. render and evaluated.
https://www.google.com/search?q=getcomputedstyle+performance
Edge:
https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/15695897/
https://github.com/OfficeDev/office-ui-fabric-react/search?q=getComputedStyle&unscoped_q=getComputedStyle
Sticky.prototype._getBackground
function findScrollableParent(startingElement) {
I only look into this because I am looking at Scroll (once, Sticky have a lot.)
On page load
https://int.pi.dynamics.com/teams/91be920fcec34852b5a6e7e4b8b33abd/projects/c97c22215b9549fc948815b57c92d83f/metrics
sticky call getComputedStyle get call 418 times !!!
I don't mind scrollable call 2 times
Expected behavior:
a. do it at the debounce & after request animation frame. (Thus blink is already eval most of the data that you ask for.)
b. stamp the class that you are looking for rather than ask the style to get for it.
Note that call 418 time get computed style is very excessive.
Priorities and help requested:
Are you willing to submit a PR to fix? (Yes, No)
Requested priority: (Blocking, High, Normal, Low)
Products/sites affected: (if applicable)
The text was updated successfully, but these errors were encountered: