Skip to content

[SourceKit] Disable automatic rebuilding of dependent-ASTs #12220

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

Merged

Conversation

benlangmuir
Copy link
Contributor

  • Explanation: Previously, after a change to one open document sourcekitd would attempt to rebuild all ASTs that might be affected by that change (e.g. to update diagnostics). While this can be useful, it create a big performance problem (both memory and time) when there are many open documents - e.g. change one file and rebuild 50 ASTs. This behaviour assumed there would only be a few open documents corresponding to e.g. files visible at the same time in an editor, but our API forces you to keep an open document for any unsaved file changes, so that assumption doesn't hold. While removing the automatic AST builds creates a functionality regression if any clients of sourcekitd knew about this behaviour, it seems worthwhile to avoid the huge performance issue.
  • Scope: Affects clients of sourcekitd that use multiple open documents.
  • Radar: rdar://problem/34415818
  • Risk: Very low; just removes a call to rebuild ASTs.
  • Testing: Tested manually in Xcode. We plan to introduce new API to make this more testable in the future.

After modifying a file, don't rebuild the ASTs for every file that
(might) depend on it.  This is very expensive if there are a lot of open
documents and we don't yet provide a way for clients to distinguish
documents that they want to update from any other documents that e.g.
are just open because they haven't been saved yet.

rdar://problem/34415818
@benlangmuir
Copy link
Contributor Author

@swift-ci please test

@tkremenek tkremenek merged commit 8ed5ab3 into swiftlang:swift-4.0-branch Oct 2, 2017
@benlangmuir benlangmuir deleted the too-many-asts-4.0 branch October 2, 2017 19:54
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

Successfully merging this pull request may close these issues.

2 participants