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

Investigate Asynchronous File IO #34773

Open
DanielRosenwasser opened this issue Oct 28, 2019 · 4 comments
Open

Investigate Asynchronous File IO #34773

DanielRosenwasser opened this issue Oct 28, 2019 · 4 comments
Assignees
Labels
Domain: Performance Reports of unusually slow behavior Experimentation Needed Someone needs to try this out to see what happens In Discussion Not yet reached consensus Suggestion An idea for TypeScript

Comments

@DanielRosenwasser
Copy link
Member

@amcasey has some ideas for speeding up IO times by making our read/write calls asynchronous. This issue tracks that and should be the place to document the outcome of the investigation.

Also related: #1857, #16607, #29100

@DanielRosenwasser DanielRosenwasser added Suggestion An idea for TypeScript In Discussion Not yet reached consensus Experiment A fork with an experimental idea which might not make it into master labels Oct 28, 2019
@DanielRosenwasser DanielRosenwasser added this to the TypeScript 3.8.0 milestone Oct 28, 2019
@DanielRosenwasser DanielRosenwasser added Experimentation Needed Someone needs to try this out to see what happens and removed Experiment A fork with an experimental idea which might not make it into master labels Oct 29, 2019
@amcasey amcasey added the Domain: Performance Reports of unusually slow behavior label Dec 6, 2019
@amcasey
Copy link
Member

amcasey commented Dec 9, 2019

I spent a week or so of this, without reaching the end of the cascading async-ness changes, so I don't have empirical performance numbers. However, @weswigham and @ahejlsberg have suggested that the overhead of making a very simple function promise-returning is unjustifiably high. I think we're going to put a pin in this and look for other ways to speed up I/O.

@weswigham
Copy link
Member

weswigham commented Dec 10, 2019

Cascading async: Bad. async cordoned to one top-level await: Good. Using Promise.all with await to pull together many async reads at once: Very good.

The v8 team did an optimization pass on async functions once before (and then reverted it?) - but their comparison "benchmark" was raw promises. async/await under common usage patterns should enable near-normal-call performance (nothing async is done -> no full promise allocated -> near-immediate return to execution), but there hasn't been a drive to invest in that yet. :(

Or my brief tests were poisoned by this v8 perf bug. Can't be sure.

@amcasey
Copy link
Member

amcasey commented Dec 10, 2019

For build mode, I believe it's possible to do that for file writing and only cascade it back up the spine. File reads are more tightly integrated and we'd have to be a lot more explicit about when a lazy read actually happens (i.e. async before the read, sync after the read). We'd almost certainly have to give up some laziness to get that and it's hard to say whether we'd come out ahead.

@amcasey
Copy link
Member

amcasey commented Jan 25, 2020

I'm working on this, but don't expect a fix to land in 3.8 - updating the milestone to reflect this.

@amcasey amcasey removed this from the TypeScript 3.8.1 milestone Jan 25, 2020
@amcasey amcasey assigned RyanCavanaugh and unassigned amcasey Nov 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Domain: Performance Reports of unusually slow behavior Experimentation Needed Someone needs to try this out to see what happens In Discussion Not yet reached consensus Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

4 participants