Skip to content

do not use ScriptVersionCache for closed files#12777

Merged
vladima merged 1 commit into
masterfrom
vladima/remove-svc-for-closed-files
Dec 9, 2016
Merged

do not use ScriptVersionCache for closed files#12777
vladima merged 1 commit into
masterfrom
vladima/remove-svc-for-closed-files

Conversation

@vladima
Copy link
Copy Markdown
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
Copy Markdown
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