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

perf(compiler): use moduleResolutionCache for Language Service's resolveModuleNames #1786

Merged
merged 2 commits into from Jul 8, 2020
Merged

perf(compiler): use moduleResolutionCache for Language Service's resolveModuleNames #1786

merged 2 commits into from Jul 8, 2020

Conversation

ahnpnl
Copy link
Collaborator

@ahnpnl ahnpnl commented Jul 8, 2020

Summary

#1784 introduced the usage resolveModuleNames API from LanguageService. I noticed that resolveModuleNames API can have a cache called ModuleResolutionCache so I went ahead and tried out. The result is amazing:

Some figures

Testing against my company's project which has 2k+ test files as well as the repo source has 2k+ files.

After #1784

 PASS  src/__tests__/pulse-items/pulse-items-filter.helper.spec.ts (5.736s)
 
 PASS  src/__tests__/hybrid-apps/widget-card-settings.handler.spec.ts (21.57s)
 
 PASS  src/__tests__/pulse-items/pulse-items-ws-res.handler.spec.ts (31.41s)
 
 PASS  src/__tests__/inbox/inbox-detail-traveller.effects.spec.ts (31.892s)
 
 PASS  src/__tests__/task-viewer/task-viewer.effects.spec.ts (31.972s)
 
 PASS  src/__tests__/shared/numeric-field.component.spec.ts (22.818s)

 PASS  src/integration-tests/inbox-message-view/email-custom-action.spec.ts (18.773s)
 
 PASS  src/integration-tests/inbox-message-view/email-standard-action.spec.ts (15.707s)

With this PR

 PASS  src/__tests__/pulse-items/pulse-items-filter.helper.spec.ts (5.387s)

 PASS  src/__tests__/hybrid-apps/widget-card-settings.handler.spec.ts (12.154s)
 
 PASS  src/__tests__/pulse-items/pulse-items-ws-res.handler.spec.ts (19.322s)
 
 PASS  src/__tests__/inbox/inbox-detail-traveller.effects.spec.ts (20.206s)
 
 PASS  src/__tests__/task-viewer/task-viewer.effects.spec.ts (19.916s)
 
 PASS  src/__tests__/shared/numeric-field.component.spec.ts (20.487s)
 
 PASS  src/integration-tests/inbox-message-view/email-custom-action.spec.ts (13.759s)
 
 PASS  src/integration-tests/inbox-message-view/email-standard-action.spec.ts (11.163s)

Some tests gain huge performance boost and overall, the time to execute the tests for the whole project improved about 20%-30%.

The difference in time between no cache run and cache run reduces to no-cache run = x1.5-2x cache run comparing to no-cache run = 2x-2.5x cache run after #1784

Test plan

Added unit test for checking the usage of ts.createModuleResolutionCache. Green CI

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

I also correct test for config-set.ts which reduced coverage in #1784

@ahnpnl ahnpnl requested a review from kulshekhar as a code owner July 8, 2020 12:28
@coveralls
Copy link

Pull Request Test Coverage Report for Build 5297

  • 2 of 2 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.07%) to 92.83%

Totals Coverage Status
Change from base Build 5296: 0.07%
Covered Lines: 1056
Relevant Lines: 1091

💛 - Coveralls

@ahnpnl ahnpnl merged commit 7f731ed into kulshekhar:master Jul 8, 2020
@ahnpnl ahnpnl deleted the cache-module-resolution branch July 8, 2020 15:38
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.

None yet

3 participants