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

Performance regression in Get<> #954

Open
panrafal opened this issue Sep 7, 2024 · 2 comments
Open

Performance regression in Get<> #954

panrafal opened this issue Sep 7, 2024 · 2 comments
Labels
bug Something isn't working component:paths

Comments

@panrafal
Copy link

panrafal commented Sep 7, 2024

After updating to the latest version I saw a huge, 50x performance regression in the type that uses Get<> underneath. The difference was measured by typescript tracing.

I don't have a reproduction, but the only commit within the last release that touches this place is this one:
986faba by @Emiyaaaaa

Looking at the change, it's reasonable it caused a slow down, as TS needs to call Path twice now. In my case, the object structure is pretty huge.
As extends string[] is much wider, why this is needed?

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • The funding will be given to active contributors.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar
@hidemire
Copy link

Hi, we are facing this issue after upgrading from 4.17.0 to 4.26.1.
But in our case Get after ~10 minutes of compilation gives error TS2589: Type instanceiation is excessively deep and possibly infinite. error.

import { type Get } from 'type-fest';
import { type EChartsOption } from 'echarts';

type XAxisOptions = Exclude<EChartsOption['xAxis'], Array<unknown> | undefined>;

type Test = Get<XAxisOptions, 'axisLabel'>;

@voxpelli
Copy link
Collaborator

Maybe we need to add some performance regression tests as these kind of things are hard to reproduce without a representatively large type graph.

The reasoning for the change in #932 was #863 though – we had inconsistent syntax support between similar types.

@hidemire Can you provide a complete example with tsconfig.json and package.json as well?

@fregante fregante added the bug Something isn't working label Sep 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working component:paths
Projects
None yet
Development

No branches or pull requests

4 participants