Skip to content
This repository was archived by the owner on Mar 4, 2020. It is now read-only.

perf: add base perf examples #2164

Merged
merged 6 commits into from
Dec 11, 2019
Merged

perf: add base perf examples #2164

merged 6 commits into from
Dec 11, 2019

Conversation

levithomason
Copy link
Member

@levithomason levithomason commented Dec 11, 2019

See the perf test plan here #773. This PR adds more perf examples/tests. The minimal scenario tests (no props) were added for every component.

Existing perf examples were migrated either to "minimal" examples or "slots" examples, depending on which they were closest to already.

Component Story Format (CSF)

Perf examples follow the Component Story Format. Any doc example can now be written in Storybook's Component Story Format.

CSF breaks everything :/

  • maximized example views throw
  • The SourceRender package used for live code editing also expects the renderable component to be the default export
  • CodeSandbox also breaks as it requires the default export to be the renderable component
  • yarn perf does not run on CSF examples

Until CSF takes off more in the community and there is more support, we will stick with what works everywhere.

Perf Example Naming

Perf example naming follows this pattern, $Component$ExampleName.perf.tsx:

  • ButtonMinimal.perf.tsx
  • ChatWithPopover.perf.tsx
  • etc.

yarn perf

Running yarn perf works for all new perf examples. It also now has a sorted table of results.

Example Min Avg Median Max
ProviderMergeThemes.perf.tsx 454.71 454.71 454.71 454.71
ChatDuplicateMessages.perf.tsx 304.58 304.58 304.58 304.58
Dropdown.perf.tsx 283.97 283.97 283.97 283.97
ChatWithPopover.perf.tsx 257.66 257.66 257.66 257.66
CustomToolbar.perf.tsx 31.8 31.8 31.8 31.8
ButtonSlots.perf.tsx 15.14 15.14 15.14 15.14
SliderMinimal.perf.tsx 14.65 14.65 14.65 14.65
ListCommon.perf.tsx 11.27 11.27 11.27 11.27
EmbedMinimal.perf.tsx 11 11 11 11
CarouselMinimal.perf.tsx 5.18 5.18 5.18 5.18
ProviderMinimal.perf.tsx 5.1 5.1 5.1 5.1
SplitButtonMinimal.perf.tsx 4.72 4.72 4.72 4.72
CheckboxMinimal.perf.tsx 4.13 4.13 4.13 4.13
ReactionMinimal.perf.tsx 3.98 3.98 3.98 3.98
DropdownMinimal.perf.tsx 3.96 3.96 3.96 3.96
AttachmentSlots.perf.tsx 3.84 3.84 3.84 3.84
AlertMinimal.perf.tsx 3.32 3.32 3.32 3.32
InputMinimal.perf.tsx 3.26 3.26 3.26 3.26
AttachmentMinimal.perf.tsx 2.77 2.77 2.77 2.77
LoaderMinimal.perf.tsx 2.62 2.62 2.62 2.62
PopupMinimal.perf.tsx 2.47 2.47 2.47 2.47
AvatarMinimal.perf.tsx 2.14 2.14 2.14 2.14
ChatMinimal.perf.tsx 1.91 1.91 1.91 1.91
ItemLayoutMinimal.perf.tsx 1.76 1.76 1.76 1.76
MenuMinimal.perf.tsx 1.39 1.39 1.39 1.39
TextAreaMinimal.perf.tsx 1.29 1.29 1.29 1.29
ButtonMinimal.perf.tsx 1.28 1.28 1.28 1.28
AccordionMinimal.perf.tsx 1.2 1.2 1.2 1.2
DialogMinimal.perf.tsx 1.14 1.14 1.14 1.14
IconMinimal.perf.tsx 0.91 0.91 0.91 0.91
GridMinimal.perf.tsx 0.89 0.89 0.89 0.89
HeaderMinimal.perf.tsx 0.82 0.82 0.82 0.82
HierarchicalTreeMinimal.perf.tsx 0.81 0.81 0.81 0.81
ListMinimal.perf.tsx 0.8 0.8 0.8 0.8
LabelMinimal.perf.tsx 0.8 0.8 0.8 0.8
DividerMinimal.perf.tsx 0.75 0.75 0.75 0.75
TableMinimal.perf.tsx 0.74 0.74 0.74 0.74
TreeMinimal.perf.tsx 0.73 0.73 0.73 0.73
VideoMinimal.perf.tsx 0.72 0.72 0.72 0.72
FormMinimal.perf.tsx 0.72 0.72 0.72 0.72
SegmentMinimal.perf.tsx 0.66 0.66 0.66 0.66
RadioGroupMinimal.perf.tsx 0.64 0.64 0.64 0.64
HeaderSlots.perf.tsx 0.63 0.63 0.63 0.63
MenuButtonMinimal.perf.tsx 0.59 0.59 0.59 0.59
AnimationMinimal.perf.tsx 0.53 0.53 0.53 0.53
PortalMinimal.perf.tsx 0.45 0.45 0.45 0.45
ToolbarMinimal.perf.tsx 0.4 0.4 0.4 0.4
FlexMinimal.perf.tsx 0.33 0.33 0.33 0.33
ImageMinimal.perf.tsx 0.28 0.28 0.28 0.28
StatusMinimal.perf.tsx 0.28 0.28 0.28 0.28
LayoutMinimal.perf.tsx 0.22 0.22 0.22 0.22
BoxMinimal.perf.tsx 0.2 0.2 0.2 0.2
TextMinimal.perf.tsx 0.19 0.19 0.19 0.19
RefMinimal.perf.tsx 0.12 0.12 0.12 0.12

exampleName,
...fieldValues[exampleName],
]),
row => -row[fields.indexOf('median')],
Copy link
Member Author

Choose a reason for hiding this comment

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

I've sorted the yarn perf results by their median values with the slowest components up top.

@DustyTheBot
Copy link
Collaborator

Warnings
⚠️ There are no updates provided to CHANGELOG. Ensure there are no publicly visible changes introduced by this PR.

Generated by 🚫 dangerJS

@miroslavstastny miroslavstastny mentioned this pull request Dec 11, 2019
18 tasks
@levithomason levithomason merged commit f209652 into master Dec 11, 2019
@levithomason levithomason deleted the perf/base-examples branch December 11, 2019 07:18
@JasonGore
Copy link
Member

JasonGore commented Dec 11, 2019

Some of these are adding a considerable amount of time (many minutes just for ChatDuplicateMessagePerf, for example) to the perf:test command. I think it'd be better to not specify iterations at all unless we're finding that the results aren't showing the data we need, and then scale it up from the default of 1.

image

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants