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

Memory leak fix: release source map info after processed and minor optimizations #8234

Merged
merged 6 commits into from Mar 29, 2019

Conversation

@scotthovestadt
Copy link
Contributor

scotthovestadt commented Mar 29, 2019

Summary

Previously, sourceMaps:

  • Was always populated with a call to getSourceMapInfo and set to an object, even when it was guaranteed to be empty.
  • Was never released from memory.

It's companion, coverage, was released from memory but unfortunately using the delete operator, which is significantly slower than = undefined even with modern V8 versions:
https://jsperf.com/delete-vs-undefined-vs-null/87

I've resolved the leak and minor performance issues along with a minor change to formatTestResults that is slightly more efficient for the same result.

Test plan

  • All tests pass.
  • Memory and performance characteristics verified.
@SimenB
SimenB approved these changes Mar 29, 2019
@codecov-io

This comment has been minimized.

Copy link

codecov-io commented Mar 29, 2019

Codecov Report

Merging #8234 into master will decrease coverage by 0.03%.
The diff coverage is 31.81%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #8234      +/-   ##
==========================================
- Coverage   62.33%   62.29%   -0.04%     
==========================================
  Files         265      265              
  Lines       10553    10554       +1     
  Branches     2565     2569       +4     
==========================================
- Hits         6578     6575       -3     
- Misses       3387     3391       +4     
  Partials      588      588
Impacted Files Coverage Δ
packages/jest-runner/src/runTest.ts 2.43% <0%> (-0.1%) ⬇️
packages/jest-reporters/src/coverage_reporter.ts 59.54% <0%> (-0.46%) ⬇️
packages/jest-core/src/ReporterDispatcher.ts 83.33% <100%> (+2.08%) ⬆️
packages/jest-test-result/src/formatTestResults.ts 55.55% <50%> (-9.67%) ⬇️

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 e08be02...69244bf. Read the comment docs.

@scotthovestadt scotthovestadt merged commit d5d2f93 into facebook:master Mar 29, 2019
0 of 10 checks passed
0 of 10 checks passed
ci/circleci: lint-and-typecheck CircleCI is running your tests
Details
ci/circleci: test-browser CircleCI is running your tests
Details
ci/circleci: test-jest-circus CircleCI is running your tests
Details
ci/circleci: test-node-10 CircleCI is running your tests
Details
ci/circleci: test-node-11 CircleCI is running your tests
Details
ci/circleci: test-node-6 CircleCI is running your tests
Details
ci/circleci: test-node-8 CircleCI is running your tests
Details
ci/circleci: test-or-deploy-website CircleCI is running your tests
Details
deploy/netlify Deploy preview processing.
Details
facebook.jest in progress
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.