-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Button: Removing Stack usage to improve perf #9516
Conversation
Exceeds Tolerance Exceeds Baseline Below Baseline 1 kB = 1000 bytes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A lot of files were touched because of prettier. I'm marking with comments those files where no logic was changed and only prettier changes were involved.
packages/office-ui-fabric-react/src/components/Coachmark/Coachmark.base.tsx
Outdated
Show resolved
Hide resolved
packages/office-ui-fabric-react/src/components/ColorPicker/ColorPicker.base.tsx
Outdated
Show resolved
Hide resolved
packages/office-ui-fabric-react/src/components/Dropdown/Dropdown.base.tsx
Outdated
Show resolved
Hide resolved
packages/office-ui-fabric-react/src/components/KeytipLayer/KeytipTree.ts
Outdated
Show resolved
Hide resolved
packages/office-ui-fabric-react/src/utilities/decorators/withViewport.tsx
Outdated
Show resolved
Hide resolved
apps/fabric-website/src/pages/Controls/SeparatorPage/docs/android/SeparatorImplementation.md
Outdated
Show resolved
Hide resolved
apps/fabric-website/src/pages/Controls/ListCellsPage/ListCellsPage.tsx
Outdated
Show resolved
Hide resolved
apps/fabric-website/src/pages/Controls/DrawerPage/DrawerPage.tsx
Outdated
Show resolved
Hide resolved
Component Perf Analysis:
|
@@ -1,6 +1,7 @@ | |||
import { IButtonComponent, IButtonStylesReturnType, IButtonTokenReturnType } from './Button.types'; | |||
import { getFocusStyle, getGlobalClassNames, FontWeights, HighContrastSelector } from '../../Styling'; | |||
import { IsFocusVisibleClassName } from '../../Utilities'; | |||
import { parseGap } from 'office-ui-fabric-react/lib/components/Stack/StackUtils'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This path doesn't seem right for a component styles file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I was hoping to get your and @dzearing input here. Basically, I didn't want to rewrite the gap parsing function that lives inside Stack
and the easiest way was to get it from this path, but I agree that it looks wrong in the context of a component styles file.
One thing we could do is make Stack
export the StackUtils
file which would allow us to use parseGap
in other places just importing it from office-ui-fabric-react
but it would increase the bundle-size of the Stack
component.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is ok for now since this is an experimental component using an OUFR utility, but it should be changed once it's promoted to a relative path.
packages/experiments/src/components/Button/SplitButton/SplitButton.types.tsx
Show resolved
Hide resolved
@@ -224,7 +224,7 @@ export class FocusZone extends React.Component<IFocusZoneProps, {}> implements I | |||
// root props has been deprecated and should get removed. | |||
// it needs to be marked as "any" since root props expects a div element, but really Tag can | |||
// be any native element so typescript rightly flags this as a problem. | |||
...(rootProps as any) | |||
...rootProps as any |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prettier change.
|
Hello @khmakoto! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
🎉 Handy links: |
* Button: Removing Stack usage from slots and view to improve perf. * Adding change files for packages that were changed because of prettier. * Deleting perf log files. * Undoing prettier changes. * Removing unused change files. * Removing BaseButton changes from Actionable PR.
Pull request checklist
$ npm run change
Description of changes
This PR removes
Stack
in favor of emulating it with flex-box styles inButton
,MenuButton
andSplitButton
, in order to improve the performance of the component.To check for the perf changes I pulled the changes @JasonGore has been working on with
puppeteer
andflamebearer
to get sample counts instead of time counts. These scenarios render the components 5000 times. I ran each scenario 10 times to get an average number and account for variants.Below are the sample counts for each of the variants before and after the
Stack
removal.DefaultButton:
Improvement of 24.26%.
PrimaryButton:
Improvement of 23.18%.
MenuButton:
Improvement of 12.00%.
SplitButton:
_Improvement of 25.12%.
Microsoft Reviewers: Open in CodeFlow