-
Notifications
You must be signed in to change notification settings - Fork 367
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
fix: TypeScript performance of DismissibleBanner.tsx
#11075
fix: TypeScript performance of DismissibleBanner.tsx
#11075
Conversation
/** | ||
* Additional styles to apply to the root element | ||
*/ | ||
sx?: SxProps; |
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.
There is no need to specify these props because they exist on the interface that this extends (NoticeProps
in this case)
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.
Also another random thought, but I wonder if sx
could be slow. I assume it is a very heavy type. Wondering if SxProps<Theme>
is any better or worse
} | ||
|
||
interface DismissibleBannerProps | ||
extends Omit<Partial<NoticeProps>, 'children'>, |
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'm wondering if Partial<NoticeProps>
might be of interest.
BarPercent.tsx
has something similar and it takes 17 seconds to type-check
})<Partial<BarPercentProps>>(({ theme, ...props }) => ({ |
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.
most likely. those used to be types unions I believe, and I remember working on those and may have messed that up trying to actually improve the performance doing an interface inheritance. I will certainly profile more often
Amazing 🥇 |
Coverage Report: ✅ |
@@ -1,31 +1,20 @@ | |||
import Close from '@mui/icons-material/Close'; | |||
import Grid from '@mui/material/Unstable_Grid2'; | |||
import { SxProps } from '@mui/system'; |
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.
Starting to wonder if importing from @mui/system
rather than @mui/material
is a main source of the slowness.
Maybe I should hurry up with pnpm. I'm 99.9% will prevent @mui/system
imports by nature...
Cloud Manager E2E Run #6650
Run Properties:
|
Project |
Cloud Manager E2E
|
Run status |
Passed #6650
|
Run duration | 27m 25s |
Commit |
c359ad9afc: fix: TypeScript performance of `DismissibleBanner.tsx` (#11075)
|
Committer | Banks Nussman |
View all properties for this run ↗︎ |
Test results | |
---|---|
Failures |
0
|
Flaky |
3
|
Pending |
2
|
Skipped |
0
|
Passing |
430
|
Description 📝
DismissibleBanner.tsx
's TypeScript types in hopes to improvetsc
performance 🧼Preview 📷
Running
tsc
got 14 seconds fasterProfile shows that
DismissibleBanner.tsx
type checks much fasterHow to test 🧪
yarn tsc --generateTrace ./trace --incremental false
and inspect withchrome://tracing
)As an Author I have considered 🤔