Skip to content
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

Optimize the Components type #893

Merged
merged 1 commit into from
Mar 3, 2025
Merged

Optimize the Components type #893

merged 1 commit into from
Mar 3, 2025

Conversation

remcohaszing
Copy link
Member

Initial checklist

  • I read the support docs
  • I read the contributing guide
  • I agree to follow the code of conduct
  • I searched issues and discussions and couldn’t find anything or linked relevant results below
  • I made sure the docs are up to date
  • I included tests (or that’s not needed)

Description of changes

The way we used ElementType caused a significant increase of resource usage for TypeScript.

I can’t really explain it, but this fixes it. I’m personally inclined to say people should avoid using the JSX namespace, but I see no other way around it.

Without this change, autocompletion in my editor takes a noticable time to load. Now it’s instant.

On my machine this halves the time of running tsc -b from ~15s to ~7s.

Closes #883

The way we used `ElementType` caused a significant increase of resource
usage for TypeScript.

I can’t really explain it, but this fixes it. I’m personally inclined to
say people should avoid using the `JSX` namespace, but I see no other way
around it.

Without this change, autocompletion in my editor takes a noticable time
to load. Now it’s instant.

On my machine this halves the time of running `tsc -b` from ~15s to ~7s.

Closes #883
@remcohaszing remcohaszing added 🐛 type/bug This is a problem 🏁 area/perf This affects performance ☂️ area/types This affects typings 👶 semver/patch This is a backwards-compatible fix 🤞 phase/open Post is being triaged manually labels Mar 1, 2025
Copy link
Member

@ChristianMurphy ChristianMurphy left a comment

Choose a reason for hiding this comment

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

I'm neutral on this.
I'm cautious about applying a fix we don't understand to a problem we don't understand.
That said nothing about this code seems particularly worrying.

@wooorm
Copy link
Member

wooorm commented Mar 3, 2025

I noticed this project was very slow recently

@wooorm wooorm merged commit 7c17ede into main Mar 3, 2025
10 checks passed
@wooorm wooorm deleted the optimize-types branch March 3, 2025 10:48
@wooorm wooorm added the 💪 phase/solved Post is done label Mar 3, 2025

This comment has been minimized.

@github-actions github-actions bot removed the 🤞 phase/open Post is being triaged manually label Mar 3, 2025
@wooorm
Copy link
Member

wooorm commented Mar 3, 2025

Thanks, released in 10.0.1!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏁 area/perf This affects performance ☂️ area/types This affects typings 💪 phase/solved Post is done 👶 semver/patch This is a backwards-compatible fix 🐛 type/bug This is a problem
Development

Successfully merging this pull request may close these issues.

[email protected] causes a significant increase in memory usage
3 participants