Skip to content

Conversation

@spmonahan
Copy link
Contributor

@spmonahan spmonahan commented Sep 23, 2022

Current Behavior

We don't have any actual test cases.

New Behavior

  • Adds test cases for Fluent v8, v9 and Web Components.
  • Updates random tree generation to optionally build trees of a target size (i.e., build a random tree with 1000 nodes)
  • Updates default fixtures to hit target sizes
  • Reduces test sample size from 25 to 10. This still gives statistically significant results but takes much less time to run.
    • Put this back to 25. It's slower but after more testing it gives more reliable results.
  • Updates the README

Related Issue(s)

Partially fixes #24424

@codesandbox-ci
Copy link

codesandbox-ci bot commented Sep 23, 2022

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit b21cfbe:

Sandbox Source
@fluentui/react 8 starter Configuration
@fluentui/react-components 9 starter Configuration

@fabricteam
Copy link
Collaborator

fabricteam commented Sep 23, 2022

📊 Bundle size report

Unchanged fixtures
Package & Exports Size (minified/GZIP)
global-context
createContext
533 B
341 B
global-context
createContextSelector
554 B
348 B
priority-overflow
createOverflowManager
3.153 kB
1.299 kB
react-accordion
Accordion (including children components)
79.083 kB
24.079 kB
react-alert
Alert
84.575 kB
21.195 kB
react-avatar
Avatar
48.874 kB
13.864 kB
react-avatar
AvatarGroup
14.996 kB
6.013 kB
react-avatar
AvatarGroupItem
68.842 kB
19.205 kB
react-badge
Badge
22.646 kB
7.228 kB
react-badge
CounterBadge
23.536 kB
7.512 kB
react-badge
PresenceBadge
24.096 kB
7.09 kB
react-button
Button
36.736 kB
9.845 kB
react-button
CompoundButton
43.761 kB
11.061 kB
react-button
MenuButton
39.43 kB
10.745 kB
react-button
SplitButton
46.876 kB
12.129 kB
react-button
ToggleButton
52.603 kB
11.317 kB
react-card
Card - All
67.216 kB
19.304 kB
react-card
Card
62.898 kB
18.22 kB
react-card
CardFooter
8.607 kB
3.622 kB
react-card
CardHeader
9.65 kB
3.962 kB
react-card
CardPreview
8.708 kB
3.678 kB
react-combobox
Combobox (including child components)
75.117 kB
24.42 kB
react-combobox
Dropdown (including child components)
74.845 kB
24.382 kB
react-components
react-components: Button, FluentProvider & webLightTheme
62.827 kB
17.599 kB
react-components
react-components: Accordion, Button, FluentProvider, Image, Menu, Popover
189.275 kB
52.503 kB
react-components
react-components: FluentProvider & webLightTheme
33.446 kB
11.033 kB
react-dialog
Dialog (including children components)
82.511 kB
24.473 kB
react-divider
Divider
16.505 kB
5.925 kB
react-image
Image
10.826 kB
4.286 kB
react-infobutton
InfoButton
7.742 kB
3.265 kB
react-input
Input
23.808 kB
7.729 kB
react-label
Label
9.384 kB
3.883 kB
react-link
Link
11.852 kB
4.888 kB
react-menu
Menu (including children components)
116.606 kB
35.755 kB
react-menu
Menu (including selectable components)
119.675 kB
36.276 kB
react-overflow
hooks only
11.004 kB
4.188 kB
react-persona
Persona
53.992 kB
15.25 kB
react-popover
Popover
102.802 kB
31.516 kB
react-portal
Portal
10.628 kB
3.899 kB
react-portal-compat
PortalCompatProvider
5.857 kB
1.978 kB
react-positioning
usePositioning
19.7 kB
7.404 kB
react-progress
Progress
11.348 kB
4.572 kB
react-provider
FluentProvider
15.807 kB
5.909 kB
react-radio
Radio
36.436 kB
12.126 kB
react-radio
RadioGroup
14.294 kB
5.723 kB
react-select
Select
20.892 kB
7.367 kB
react-slider
Slider
31.805 kB
10.085 kB
react-spinbutton
SpinButton
44.228 kB
12.454 kB
react-spinner
Spinner
20.023 kB
6.461 kB
react-switch
Switch
33.388 kB
10.578 kB
react-text
Text - Default
11.828 kB
4.627 kB
react-text
Text - Wrappers
15.138 kB
5.064 kB
react-textarea
Textarea
25.064 kB
8.158 kB
react-theme
Single theme token import
69 B
89 B
react-theme
Teams: all themes
29.65 kB
6.444 kB
react-theme
Teams: Light theme
17.486 kB
5.057 kB
react-tooltip
Tooltip
41.694 kB
14.685 kB
react-utilities
SSRProvider
180 B
159 B
🤖 This report was generated against 42acccd4445b42c806f957de00e5f2567589279f

@size-auditor
Copy link

size-auditor bot commented Sep 23, 2022

Asset size changes

Size Auditor did not detect a change in bundle size for any component!

Baseline commit: 42acccd4445b42c806f957de00e5f2567589279f (build)

@spmonahan spmonahan force-pushed the stress-test/new-tests branch from 74c1ee3 to abe4d04 Compare September 26, 2022 17:11
@spmonahan spmonahan requested review from a team and ThomasMichon as code owners September 28, 2022 22:17
Adds tests cases for

  - mounting
  - injecting styles
  - adding lots of nodes
  - removing all nodes
  - re-rendering the entire page

for Fluent V8, V9 and Web Components.

Introduces the concept of "renderers" that easily allow different
components to be slotting into tests with just a query parameter.

Moves RandomTree code to scripts to handle a ts-node compilation issue.
This isn't ideal but it doesn't seem worth spending lots of time figuring
the proper issue out right now.

Similarly, some of the randomization code has been moved around in scripts
because ts-node was having difficulty importing it.
Adds a "target size" option to RandomTree that, when set, builds a tree
to a specific size.

Tweaks the default fixture parameters based on manual testing. Fixtures
essentially double in size for each t-shirt size.

Reduces the default number of Tachometer samples from 25 to 10. In some
testing this still gives statistically significant results for all
default sizes while making tests take significantly less time to run.
This feature was removed in favor of query params.
Fix inaccuracies, document new features.
@fabricteam
Copy link
Collaborator

fabricteam commented Oct 10, 2022

Perf Analysis (@fluentui/react-components)

No significant results to display.

All results

Scenario Render type Master Ticks PR Ticks Iterations Status
Avatar mount 1316 1342 5000
Button mount 930 953 5000
FluentProvider mount 1584 1589 5000
FluentProviderWithTheme mount 633 635 10
FluentProviderWithTheme virtual-rerender 595 598 10
FluentProviderWithTheme virtual-rerender-with-unmount 635 609 10
MakeStyles mount 1937 1892 50000
SpinButton mount 2607 2533 5000

@fabricteam
Copy link
Collaborator

fabricteam commented Oct 10, 2022

Perf Analysis (@fluentui/react-northstar)

Perf tests with no regressions
Scenario Current PR Ticks Baseline Ticks Ratio
ButtonMinimalPerf.default 175 157 1.11:1
AlertMinimalPerf.default 265 242 1.1:1
VideoMinimalPerf.default 741 680 1.09:1
ButtonSlotsPerf.default 532 492 1.08:1
ChatDuplicateMessagesPerf.default 261 242 1.08:1
IconMinimalPerf.default 651 609 1.07:1
RadioGroupMinimalPerf.default 439 416 1.06:1
AttachmentSlotsPerf.default 1100 1048 1.05:1
LabelMinimalPerf.default 374 357 1.05:1
FlexMinimalPerf.default 275 265 1.04:1
GridMinimalPerf.default 329 317 1.04:1
ReactionMinimalPerf.default 366 352 1.04:1
TextMinimalPerf.default 340 326 1.04:1
DropdownManyItemsPerf.default 644 628 1.03:1
HeaderMinimalPerf.default 349 339 1.03:1
HeaderSlotsPerf.default 753 732 1.03:1
ListNestedPerf.default 551 535 1.03:1
SegmentMinimalPerf.default 343 334 1.03:1
SkeletonMinimalPerf.default 328 319 1.03:1
AccordionMinimalPerf.default 142 139 1.02:1
AttachmentMinimalPerf.default 143 140 1.02:1
BoxMinimalPerf.default 336 331 1.02:1
LayoutMinimalPerf.default 353 345 1.02:1
MenuMinimalPerf.default 832 815 1.02:1
SliderMinimalPerf.default 1600 1572 1.02:1
StatusMinimalPerf.default 667 652 1.02:1
TreeMinimalPerf.default 804 789 1.02:1
CarouselMinimalPerf.default 443 439 1.01:1
DatepickerMinimalPerf.default 5717 5658 1.01:1
DialogMinimalPerf.default 759 754 1.01:1
DividerMinimalPerf.default 341 339 1.01:1
FormMinimalPerf.default 363 360 1.01:1
ImageMinimalPerf.default 375 373 1.01:1
InputMinimalPerf.default 1114 1104 1.01:1
PopupMinimalPerf.default 620 614 1.01:1
ProviderMergeThemesPerf.default 1270 1254 1.01:1
TableMinimalPerf.default 394 391 1.01:1
AnimationMinimalPerf.default 520 522 1:1
AvatarMinimalPerf.default 186 186 1:1
CardMinimalPerf.default 520 520 1:1
ChatMinimalPerf.default 703 700 1:1
DropdownMinimalPerf.default 2663 2668 1:1
EmbedMinimalPerf.default 3633 3639 1:1
ListMinimalPerf.default 496 496 1:1
RosterPerf.default 2118 2117 1:1
ProviderMinimalPerf.default 401 401 1:1
RefMinimalPerf.default 216 216 1:1
SplitButtonMinimalPerf.default 4341 4333 1:1
TableManyItemsPerf.default 1851 1851 1:1
TooltipMinimalPerf.default 2249 2250 1:1
ItemLayoutMinimalPerf.default 1160 1173 0.99:1
ListCommonPerf.default 608 615 0.99:1
MenuButtonMinimalPerf.default 1668 1687 0.99:1
CustomToolbarPrototype.default 2630 2663 0.99:1
ButtonOverridesMissPerf.default 1283 1312 0.98:1
CheckboxMinimalPerf.default 2063 2100 0.98:1
ListWith60ListItems.default 585 597 0.98:1
LoaderMinimalPerf.default 661 673 0.98:1
ToolbarMinimalPerf.default 882 898 0.98:1
TreeWith60ListItems.default 154 158 0.97:1
PortalMinimalPerf.default 160 166 0.96:1
ChatWithPopoverPerf.default 351 369 0.95:1
TextAreaMinimalPerf.default 431 458 0.94:1

@fabricteam
Copy link
Collaborator

fabricteam commented Oct 10, 2022

Perf Analysis (@fluentui/react)

No significant results to display.

All results

Scenario Render type Master Ticks PR Ticks Iterations Status
BaseButton mount 1179 1170 5000
Breadcrumb mount 2928 2957 1000
Checkbox mount 2652 2630 5000
CheckboxBase mount 2357 2323 5000
ChoiceGroup mount 4368 4392 5000
ComboBox mount 1239 1273 1000
CommandBar mount 9575 9578 1000
ContextualMenu mount 11208 11355 1000
DefaultButton mount 1357 1368 5000
DetailsRow mount 3606 3605 5000
DetailsRowFast mount 3641 3594 5000
DetailsRowNoStyles mount 3418 3513 5000
Dialog mount 3103 3102 1000
DocumentCardTitle mount 575 571 1000
Dropdown mount 3200 3203 5000
FocusTrapZone mount 2007 1988 5000
FocusZone mount 1959 2009 5000
GroupedList mount 52198 58622 2
GroupedList virtual-rerender 24827 24455 2
GroupedList virtual-rerender-with-unmount 95956 92807 2
GroupedListV2 mount 560 557 2
GroupedListV2 virtual-rerender 522 535 2
GroupedListV2 virtual-rerender-with-unmount 553 570 2
IconButton mount 1865 1905 5000
Label mount 729 735 5000
Layer mount 4266 4218 5000
Link mount 822 820 5000
MenuButton mount 1677 1673 5000
MessageBar mount 2368 2364 5000
Nav mount 3263 3279 1000
OverflowSet mount 1353 1361 5000
Panel mount 2545 2523 1000
Persona mount 1238 1282 1000
Pivot mount 1666 1647 1000
PrimaryButton mount 1507 1524 5000
Rating mount 7015 7071 5000
SearchBox mount 1534 1486 5000
Shimmer mount 2808 2840 5000
Slider mount 2086 2067 5000
SpinButton mount 4702 4653 5000
Spinner mount 795 794 5000
SplitButton mount 3102 3109 5000
Stack mount 858 858 5000
StackWithIntrinsicChildren mount 2348 2348 5000
StackWithTextChildren mount 4801 4785 5000
SwatchColorPicker mount 10526 10337 5000
TagPicker mount 2626 2698 5000
TeachingBubble mount 86243 87690 5000
Text mount 778 770 5000
TextField mount 1593 1593 5000
ThemeProvider mount 1522 1522 5000
ThemeProvider virtual-rerender 1090 1075 5000
ThemeProvider virtual-rerender-with-unmount 2137 2174 5000
Toggle mount 1097 1109 5000
buttonNative mount 533 545 5000

Improve test consistency across browsers. Firefox and Chrome/Edge can
measure different things in certain scenarios so this commit updates the
measurements for mount to account for this.

The React Profiler has been enabled so we can get timing information from
React. In particular this is useful for knowing when React started doing
work.
@spmonahan spmonahan force-pushed the stress-test/new-tests branch from a08591f to e0cbefb Compare October 10, 2022 17:03

terser@^4.1.2, terser@^4.3.9, terser@^4.6.12, terser@^4.6.2, terser@^4.6.3:
version "4.8.1"
version "4.8.0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wondering what triggered this downgrade ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure since the only dep change I made was to remove chromedriver and it does not depend on Terser. I've also pulled in upstream changes. Maybe something from there?

Copy link
Contributor

@Hotell Hotell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approving for v-build affected changes

Copy link
Collaborator

@JustSlone JustSlone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see this is a large PR, I assume this is a one-time thing given the specific phase a development the test was in, and, in the future, we'll have more specific PRs for particular changes.

Tachometer sometimes fails during a test run. It's not entirely clear
why this happens but it seems like there are two scenarios:

1. chromedriver needs to be installed or updated. Tachometer handles
   this dependency for us but when the dep is installed the test run
   fails. Subsequent test runs are fine so retry logic addresses this.
2. Timing is off. This issue is less clear but it seems like when a
   browser is slow to start Tachometer might time out. This doesn't
   seem like an actual issue with the tool and more just occasional
   flakiness in the system.

While not addressing the root cause of either of these issues retry
gives stress-test the ability to handle little speed bumps better.
@spmonahan spmonahan merged commit 314a7d6 into microsoft:master Oct 11, 2022
NotWoods pushed a commit to NotWoods/fluentui that referenced this pull request Nov 18, 2022
* stress test: adds test cases for v8, v9 and web components

Adds tests cases for

  - mounting
  - injecting styles
  - adding lots of nodes
  - removing all nodes
  - re-rendering the entire page

for Fluent V8, V9 and Web Components.

Introduces the concept of "renderers" that easily allow different
components to be slotting into tests with just a query parameter.

Moves RandomTree code to scripts to handle a ts-node compilation issue.
This isn't ideal but it doesn't seem worth spending lots of time figuring
the proper issue out right now.

Similarly, some of the randomization code has been moved around in scripts
because ts-node was having difficulty importing it.

* stress test: configure fixtures, tree generation and sample sizes

Adds a "target size" option to RandomTree that, when set, builds a tree
to a specific size.

Tweaks the default fixture parameters based on manual testing. Fixtures
essentially double in size for each t-shirt size.

Reduces the default number of Tachometer samples from 25 to 10. In some
testing this still gives statistically significant results for all
default sizes while making tests take significantly less time to run.

* stress test: remove 'renderers' cli option

This feature was removed in favor of query params.

* stress test: update readme

Fix inaccuracies, document new features.

* stress-test: improve tests

Improve test consistency across browsers. Firefox and Chrome/Edge can
measure different things in certain scenarios so this commit updates the
measurements for mount to account for this.

The React Profiler has been enabled so we can get timing information from
React. In particular this is useful for knowing when React started doing
work.

* Change default sample-size from 10 to 25

* add stress-test to codeowners

* stress-test: add retry logic for tachometer

Tachometer sometimes fails during a test run. It's not entirely clear
why this happens but it seems like there are two scenarios:

1. chromedriver needs to be installed or updated. Tachometer handles
   this dependency for us but when the dep is installed the test run
   fails. Subsequent test runs are fine so retry logic addresses this.
2. Timing is off. This issue is less clear but it seems like when a
   browser is slow to start Tachometer might time out. This doesn't
   seem like an actual issue with the tool and more just occasional
   flakiness in the system.

While not addressing the root cause of either of these issues retry
gives stress-test the ability to handle little speed bumps better.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stress Test: Add more testing scenarios

7 participants