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(build): Use WebWorker when removing private fields #3821

Merged
merged 2 commits into from
Jan 17, 2025

Conversation

miyaji255
Copy link
Contributor

removePrivateFields is a heavy CPU-bound process. This PR improves performance by using all CPU in WebWorker.

The following is the removePrivateFields time for the current build process.

Environemt:

  • CPU: Intel(R) Core(TM) i7-12700F (20 Cores)
  • RAM: 32GB

Current: 47750.3256ms
This PR: 10963.4007ms

The Github Actions environment is 4 CPUs, so CI may not improve performance that much. I think it will be very fast in local environment.

Copy link

codecov bot commented Jan 14, 2025

Codecov Report

Attention: Patch coverage is 48.91304% with 47 lines in your changes missing coverage. Please review.

Project coverage is 91.30%. Comparing base (2ead4d8) to head (36f2a72).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
build/remove-private-fields.ts 0.00% 32 Missing ⚠️
build/remove-private-fields-worker.ts 75.00% 15 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3821      +/-   ##
==========================================
- Coverage   91.71%   91.30%   -0.41%     
==========================================
  Files         160      161       +1     
  Lines       10195    10241      +46     
  Branches     2885     2848      -37     
==========================================
+ Hits         9350     9351       +1     
- Misses        844      889      +45     
  Partials        1        1              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@yusukebe
Copy link
Member

Hi @miyaji255

This is super cool! I've tried it, and it's working very fast on my machine. I love this change.

@nakasyou Can you review this PR?

@nakasyou
Copy link
Contributor

Yes but about a day please🙏

@yusukebe
Copy link
Member

@nakasyou No problem!

Copy link
Contributor

@nakasyou nakasyou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good! Check my review.

build/remove-private-fields.ts Outdated Show resolved Hide resolved
Co-authored-by: Shotaro Nakamura <79000684+nakasyou@users.noreply.github.com>
Copy link
Member

@yusukebe yusukebe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@yusukebe
Copy link
Member

@miyaji255

Thank you for your great work! Merging.

@yusukebe yusukebe merged commit 6fd7d0b into honojs:main Jan 17, 2025
16 checks passed
@miyaji255 miyaji255 deleted the build-with-worker branch January 17, 2025 10:30
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