Faster startup (4/4): Lazy imports and V8 compile cache#7054
Draft
gonzaloriestra wants to merge 1 commit intofaster-startup-3from
Draft
Faster startup (4/4): Lazy imports and V8 compile cache#7054gonzaloriestra wants to merge 1 commit intofaster-startup-3from
gonzaloriestra wants to merge 1 commit intofaster-startup-3from
Conversation
3 tasks
Contributor
Author
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
3 tasks
39c47da to
377c2e4
Compare
9adcd0c to
35d5a30
Compare
Defer heavy module imports to point of use across the codebase: - base-command: lazy ui.js (600KB React/Ink), error-handler, notifications - prerun hook: parallel imports via Promise.all - postrun hook: lazy analytics and deprecations - node-package-manager: lazy latest-version import - context/local: lazy fs.js and system.js (break circular deps) - is-global: lazy output.js, system.js, version.js, ui.js - custom-oclif-loader: fire-and-forget init hooks via runHook override Enable V8 compile cache via module.enableCompileCache() in dev.js/run.js, caching bytecode between runs to eliminate ~30ms compile overhead. Combined improvement: ~130ms across all commands Made-with: Cursor
35d5a30 to
ea5104e
Compare
377c2e4 to
29e09f4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

WHY are these changes introduced?
The CLI requires too much time to start working, it feels slow
WHAT is this pull request doing?
Defers heavy module imports to point of use across the codebase and enables V8 compile caching for faster subsequent runs.
ui.js(600KB React/Ink),error-handler.js,notifications-system.js,environments.js— only loaded when actually neededPromise.allfor analytics, notifications, and package-manager moduleslatest-versionimport (~113ms saved)fs.jsandsystem.jsto break circular dependency chainsoutput.js,system.js,version.js,ui.jsrunHookoverride soapp-initandhydrogen-initrun in backgroundmodule.enableCompileCache()indev.js/run.jscaches bytecode between runs, eliminating ~30ms compile overheadCombined improvement: ~130ms across all commands
How to test your changes?
shopify version/shopify helpreturn correct outputMeasuring impact
Checklist
Made with Cursor