Skip to content

perf: speed up all commands by 75+ ms by enabling V8 code cache when available (node>=22.8.0) #7173

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

Merged
merged 10 commits into from
Apr 8, 2025

Conversation

serhalp
Copy link
Collaborator

@serhalp serhalp commented Apr 8, 2025

Summary

See https://nodejs.org/api/module.html#module-compile-cache.

In local benchmarking on various machines, this led to a 75-400 ms improvement to command run time across the board, at the expense of a moderate increase in first-time run time.

See inline - to account for the common CI single-run use case, this is disabled when we detect a CI environment.

See individual commits for context on the other changes here.

@@ -203,7 +204,6 @@
"eslint-config-prettier": "^10.1.1",
"eslint-plugin-n": "^17.16.1",
"form-data": "4.0.2",
"is-ci": "4.1.0",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

was unused

"@types/node": "22.13.10",
"@types/node": "18.19.86",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was incorrectly upgraded. We support min. 18 so we need v18 types.

Copy link

github-actions bot commented Apr 8, 2025

📊 Benchmark results

Comparing with cef9426

  • Dependency count: 1,173 (no change)
  • Package size: 284 MB ⬇️ 0.10% decrease vs. cef9426
  • Number of ts-expect-error directives: 426 (no change)

serhalp added 2 commits April 8, 2025 10:57
The `preAction` hook was overwriting the whole payload, so any prior calls to
`setAnalyticsPayload` would have their data thrown away.

This didn't matter, but I'd like to introduce an early call.
See https://nodejs.org/api/module.html#module-compile-cache.

In local benchmarking on various machines, this led to a 75-400 ms improvement to command
run time across the board, at the expense of a moderate increase in first-time run time.

See inline - to account for the common CI single-run use case, this is disabled when we
detect a CI environment.
@serhalp serhalp changed the title perf: enable V8 code cache when available perf: shave 75+ ms all commands by enabling V8 code cache when available (node>=22.8.0) Apr 8, 2025
@serhalp serhalp changed the title perf: shave 75+ ms all commands by enabling V8 code cache when available (node>=22.8.0) perf: speed up all commands by 75+ ms by enabling V8 code cache when available (node>=22.8.0) Apr 8, 2025
@serhalp serhalp marked this pull request as ready for review April 8, 2025 15:14
@serhalp serhalp requested review from a team as code owners April 8, 2025 15:14
Copy link
Contributor

@ndhoule ndhoule left a comment

Choose a reason for hiding this comment

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

Minor suggestions around how to make this a little cleaner and better documented--address those as you see fit. I marked the only potential blocking issue with a ⚠️.

@serhalp serhalp requested a review from ndhoule April 8, 2025 18:48
@ndhoule
Copy link
Contributor

ndhoule commented Apr 8, 2025

🐎

@serhalp serhalp merged commit a916f23 into main Apr 8, 2025
52 checks passed
@serhalp serhalp deleted the CPLA-2661 branch April 8, 2025 19:46
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.

2 participants