Uh oh!
There was an error while loading. Please reload this page.
Experiment: replace cancellable with async - #18239
Conversation
❗ Release notes requiredCaution No release notes found for the changed paths (see table below). Please make sure to add an entry with an informative description of the change as well as link to this pull request, issue and language suggestion if applicable. Release notes for this repository are based on Keep A Changelog format. The following format is recommended for this repository:
If you believe that release notes are not necessary for this PR, please add NO_RELEASE_NOTES label to the pull request. You can open this PR in browser to add release notes: open in github.dev
|
vzarytovskii
commented
Jan 15, 2025
In a couple of places, because of cancellable, we had to use stackguard. Since async handles tail recursion rather well, we might want to rethink it. |
vzarytovskii
commented
Jan 15, 2025
Also, we need to review places we used cancellable (and now async), if there are any routines which are fully sync, and now will have quite a bit of overhead of creating async. |
majocha
commented
Jan 15, 2025
So this surprisingly passed :) and it seems the test run wasn't noticeably slower. Allocations is probably another story.
Yes, those I just removed for now.
Looks like the performance critical place where |
majocha
commented
Jan 16, 2025
FCSSourceFiles benchmark this PR:
vs main:
|
vzarytovskii
commented
Jan 16, 2025
Just removing stack guards might be dangerous, as it can result in SOs on desktop still. |
majocha
commented
Jan 16, 2025
I mean all the recursive calls are now async |
vzarytovskii
commented
Jan 16, 2025
It should, yes. We just want to be sure that every path will result in proper recursion |
There was a problem hiding this comment.
This looks too easy to miss in future updates/additions to the service layer.
Is there something we can do to prevent such mistakes?
There was a problem hiding this comment.
Enforce it with types, which means use a specialized CE internally again :)
c030a95 to
1227542Comparemajocha
commented
Jan 16, 2025
As usual I'm dogfooding this by running a vsix and it seems fine. But I'm kind of worried about performance. In the benchmark the speed is similar and about 3% more allocation but what about really large codebases of the kind that required the stack guard there? Will it slow down to a crawl? Eat up all of the RAM? |
T-Gro
commented
Jan 17, 2025
There are tests which include very large files (I think part of Fsharp.Suite), and some auto-generated massive tests. |
vzarytovskii
commented
Jan 17, 2025
Also should keep in mind that allocations grow when you just work with your codebase, as changes trigger typechecks. My usual "benchmark" is to change something in FCS while working on vsix, multiple times. |
After some testing, this feels definitely slower / laggier in VS especially with many documents open. |
T-Gro
commented
Jan 20, 2025
I wonder if we could make that would be a no-op in case of not needing to create any Task. |
majocha
commented
Jan 20, 2025
As first approximation we could just add overloads to |
majocha
commented
Jan 29, 2025
Closing this for now, some explorations continue in #18285. |
#18238 (comment)