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

Asynchronous addSourceFilesAtPaths and other methods #759

Open
dsherret opened this issue Nov 16, 2019 · 1 comment
Open

Asynchronous addSourceFilesAtPaths and other methods #759

dsherret opened this issue Nov 16, 2019 · 1 comment

Comments

@dsherret
Copy link
Owner

dsherret commented Nov 16, 2019

Right now the methods for adding sources files from the file system are synchronous and the ones for writing back to the file system are asynchronous by default (with sync api available via -Sync methods).

This was done because the compiler api reads from the file system synchronously. That said, methods like addSourceFilesAtPaths, addSourceFileAtPath, etc... could all be asynchronous. addSourceFilesAtPaths in particular could get a huge performance boost by parallelizing the work.

The existing api would be moved to -Sync methods. For example, addSourceFilesAtPaths would become addSourceFilesAtPathsSync and then be replaced with an asynchronous addSourceFilesAtPaths. The downside to this change is that if someone doesn't read the breaking changes doc and is not inspecting the return value, then they might not notice this has become asynchronous.

Relates to #702.

dsherret added a commit that referenced this issue Dec 8, 2019
BREAKING CHANGE: @ts-morph/bootstrap now has an asynchronous input API. All methods for adding source files are asynchronous with corresponding synchronous methods. Also, creating a project is now created by either `createProject` or `createProjectSync` functions.
dsherret added a commit that referenced this issue Dec 9, 2019
BREAKING CHANGE: @ts-morph/bootstrap now has an asynchronous input API. All methods for adding source files are asynchronous with corresponding synchronous methods. Also, creating a project is now created by either `createProject` or `createProjectSync` functions.
dsherret added a commit that referenced this issue Feb 23, 2020
BREAKING CHANGE: @ts-morph/bootstrap now has an asynchronous input API. All methods for adding source files are asynchronous with corresponding synchronous methods. Also, creating a project is now created by either `createProject` or `createProjectSync` functions.
@scarf005
Copy link
Contributor

hi, would it be possible to introduce asynchronous input API also for ts-morph (like in ts-morph/bootstrap)? i have found out it on private repo with ~400 files, it's up to 900% slower (100ms vs 1000ms) to load the files into project in synchronous manner.

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

No branches or pull requests

2 participants