Skip to content

Optimize array operations to reduce memory footprint#18153

Merged
ahejlsberg merged 1 commit intomasterfrom
optimizeArrays
Sep 7, 2017
Merged

Optimize array operations to reduce memory footprint#18153
ahejlsberg merged 1 commit intomasterfrom
optimizeArrays

Conversation

@ahejlsberg
Copy link
Member

With this PR we optimize array operations in the parser and binder to reduce overall memory consumption of syntax trees and binding information. Specifically, since arrays are often constructed by starting with an empty array and repeatedly calling push(), arrays may not have an optimal memory layout. We now invoke slice() for small arrays (1 to 4 elements) to give the VM a chance to allocate an optimal representation.

These optimizations reduce the overall size of syntax trees and binding information by ~10%. For example, memory consumption of the syntax trees and binding information for the Monaco project is reduced from 162 Mb to 145 Mb.

@ahejlsberg ahejlsberg merged commit 8c64937 into master Sep 7, 2017
@ahejlsberg ahejlsberg deleted the optimizeArrays branch September 7, 2017 21:27
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 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