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

do not use ScriptVersionCache for closed files #12777

Merged
merged 1 commit into from
Dec 9, 2016

Conversation

vladima
Copy link
Contributor

@vladima vladima commented Dec 8, 2016

ScriptVersionCache internally stores text in tree-like form which is very efficient for editing purposes and at the same time pretty expensive to be used as a generic storage. Size of the tree is proportional to the size of the file and varies from 1.5 x (size of text) for small files through to 3x up to 10x in a degenerate cases (like 40 MB files). As an example android.d.ts is ~13 MB file and its tree representation is takes roughly 40 MB.

To avoid paying this cost I've introduced TextStorage abstraction that internally can either store text as is or use ScriptVersionCache. ScriptVersionCache is used for open files or for some operations that cannot be efficiently used on plain text (like editing). For all other cases it uses plain text deferring its loading (which is useful for scenarios when language service is disabled).

// cc @mhegazy

@mhegazy
Copy link
Contributor

mhegazy commented Dec 8, 2016

we need to port these into release-2.1 as well.

@vladima vladima merged commit 7da3383 into master Dec 9, 2016
@vladima vladima deleted the vladima/remove-svc-for-closed-files branch December 9, 2016 00:17
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants