Skip to content

reducing memory allocation in ConcatSource and ReplaceSource - #31

Merged
sokra merged 3 commits into
webpack:masterfrom
MagicDuck:fix_memory_alloc
Nov 25, 2017
Merged

sokra merged 3 commits into
webpack:masterfrom
MagicDuck:fix_memory_alloc

Conversation

@MagicDuck

Copy link
Copy Markdown
Contributor

using (+=) operator instead of array join/reduce to reduce memory allocation.

This causes nodejs to treat the strings internally as "concatenated strings"
and reuse the pieces instead of allocating new memory.
see: #30

For the ConcatSource::size() change, we are simply removing the need to allocate an array to compute the size.

@jsf-clabot

jsf-clabot commented Nov 24, 2017 •

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Stephan Badragan seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.

…ocation

This causes nodejs to treat the strings internally as "concatenated strings"
and reuse the pieces instead of allocating new memory.
see: webpack#30
@codecov

codecov Bot commented Nov 24, 2017 •

Copy link
Copy Markdown

Codecov Report

Merging #31 into master will increase coverage by 0.41%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #31      +/-   ##
==========================================
+ Coverage   70.84%   71.25%   +0.41%     
==========================================
  Files          11       11              
  Lines         415      421       +6     
  Branches       64       64              
==========================================
+ Hits          294      300       +6     
  Misses        121      121
Impacted Files Coverage Δ
lib/ConcatSource.js 100% <100%> (ø) ⬆️
lib/ReplaceSource.js 92.85% <100%> (+0.11%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e1880a0...a28dd05. Read the comment docs.

@sokra
sokra merged commit d79f3e9 into webpack:master Nov 25, 2017
@sokra

sokra commented Nov 25, 2017

Copy link
Copy Markdown
Member

Thanks

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.

3 participants