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

Improve performance with lazy processing / calculation timeout #50

Open
finnmerlett opened this issue Mar 17, 2024 · 1 comment
Open

Comments

@finnmerlett
Copy link

finnmerlett commented Mar 17, 2024

I suddenly started having my intellisense hang indefinitely on a cypress project, and after an extension bisect found ts-type-explorer was the issue. Thankfully I solved the problem by lowering the max recursion depth to 4. I figured the type-structure must have branched out too rapidly, but it made me think there must be a better way to handle recusion calculation overload. My suggestions are:

  1. Only explore and find the types when the user expands that part of the type explorer.

    • There is no point collecting n-levels depth of type information if the nodes are collapsed, and this approach would prevent the exponential slowdown as depth increases. It would also remove the need to set a hard cap on the depth explorable.
    • EDIT: I do see that another user asked about this issue, and that the answer was: it was already implemented on some, but tricky to implement on specific types of types
  2. Allow the user to set a calculation timeout at which point to stop further recursing.

    • This could be used instead of a hard depth stop, particularly if the approach was to calculate level n of recursion for the entire tree, before level n+1. This would fit better with a variety of codebase sizes and complexities, and also let the user know what was going wrong if their computer had ground to a halt.

Also to note - I was having my intellisense hang even when I had not focused the type-explorer tab. This feels like a mis-step, I wouldn't mind a delay when opening the tab, if it meant a more performant codebase the rest of the time. A spinner and a "stop calculation" button would be good UI additions too.

@virtuallyunknown
Copy link

I am having my whole VSCode hang when @tanstack/react-form is installed. After disabling all extensions one by one, I have figured out that the Typescript Explorer was causing this issue.

Example bare-minimum repo where you can observe the issue:

https://github.com/virtuallyunknown/tanstack-form-performance

Peek.2024-04-01.21-05.mp4

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

No branches or pull requests

2 participants