Performance: Stack.Horizontal.Wrap.Example.tsx has bad CSS example lead to bad browser performance.
Environment Information
- Package version(s): (fill this out)
- Browser and OS versions: (fill this out if relevant)
Please provide a reproduction of the bug in a codepen:
Actual behavior:
I am Code Reviewing peer's change and flag the browser render engine (Edge, Blink, Trident) potential rendering engine over head, He point out he copy that from the Sample code.
https://github.com/OfficeDev/office-ui-fabric-react/blob/1b705beb1cad712f93da2954511b7d6a1d583797/packages/office-ui-fabric-react/src/components/Stack/examples/Stack.Horizontal.Wrap.Example.tsx#L22
This is out of experience from working with Edge perf lead. In general, CSS should avoid <tag> name. It is especially worst when it is last of the CSS rule.
- Browser tend to optimize for div/span with class name (Hash)
- Browser tend eval the rule to apply form right to left. --- when you specified rule end with <span> that lead to Hash look up failed, end up gather every <span> on the page!! then leading down to bad browser performance.
This example happen to hit both. In general, example should avoid performance pitfall.
Expected behavior:
Change to the last <span> a class name
https://github.com/OfficeDev/office-ui-fabric-react/blob/1b705beb1cad712f93da2954511b7d6a1d583797/packages/office-ui-fabric-react/src/components/Stack/examples/Stack.Horizontal.Wrap.Example.tsx#L22
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)
@LiangMingChen thank you for reporting this issue! This is a valid concern and we are looking into this.
:tada:This issue was addressed in #9403, which has now been successfully released as [email protected].:tada:
Handy links: