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

Reduce memory overhead of sourcemapLocations #169

Merged
merged 1 commit into from Jan 2, 2020

Conversation

mihaip
Copy link
Contributor

@mihaip mihaip commented Nov 19, 2019

It was using an object to store positions in the string. This meant that those offsets were first stringified and then added as object properties. For a 200K JS code file (as parsed by rollup), the
sourcemapLocations object was taking up 980K. Switching it to a BitSet (contribution by @kzc) that uses one bit per offset makes it take up 36K instead.

Fixes #167

It was using an object to store positions in the string. This meant that
those offsets were first stringified and then added as object
properties. For a 200K JS code file (as parsed by rollup), the
sourcemapLocations object was taking up 980K. Switching it to a BitSet
that uses one bit per offset makes it take up 36K instead.

Fixes Rich-Harris#167
@mihaip
Copy link
Contributor Author

mihaip commented Nov 19, 2019

Original memory use:
image

Bit set memory use:
image

(FWIW, using a vanilla Set would take up 327K)

@kzc
Copy link
Contributor

kzc commented Nov 20, 2019

@mihaip Thanks for profiling and putting this PR together.

@kzc
Copy link
Contributor

kzc commented Nov 20, 2019

@mourner This PR is significant enough to warrant a new release. Thanks in advance.

@mihaip
Copy link
Contributor Author

mihaip commented Dec 30, 2019

@mourner @Rich-Harris any thoughts on getting this merged?

@Rich-Harris Rich-Harris merged commit 76487c0 into Rich-Harris:master Jan 2, 2020
@Rich-Harris
Copy link
Owner

This is wonderful, thank you! Released 0.25.5

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.

Memory overhead of sourcemapLocations is high
3 participants