perf: enable faster Ace bootstrap with targeted exports - #5146
Open
RomainLanz wants to merge 1 commit into
Open
Conversation
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.
Hey! 👋
Importing bootstrap primitives from
@adonisjs/coreevaluates the root entrypoint and its aggregated error namespaces. Light Ace commands therefore load modules they never use.This PR adds coherent targeted exports:
@adonisjs/core/ignitorexportsIgnitorandprettyPrintError@adonisjs/core/generatorsexportsindexEntities@adonisjs/core/confignow also exportsconfigProviderAll root exports remain available for backward compatibility. The
addcommand also importsprettyPrintErrordirectly from its owning module.Measured impact
The benchmark uses the official Hypermedia starter generated with:
npm create adonisjs@3.4.0 perf-adonis-hypermedia -- --kit=hypermedia --pkg=npm --skip-migrationsThe optimized fixture switches the generated bootstrap files,
adonisrc.ts, Auth, and Session away from the root export. Those consumer changes will be proposed separately.Values are wall-clock medians with
[p05, p95].node ace --help[319.53, 394.04][250.89, 314.37]node ace --help[307.99, 396.53][251.82, 313.49]node ace test --help[323.46, 396.24][256.57, 324.01]node ace test --help[317.27, 394.58][252.44, 312.68]Each variant ran in 50 fresh processes after 5 warmups. Execution order was randomized with a fixed seed, processes were pinned to one CPU, output was discarded, and no outliers were removed. Wall time and peak RSS came from
perf_counter_nsandwait4.An isolated import of
Ignitor,prettyPrintError, andindexEntitiesdrops from 209.02 ms to 89.64 ms on Node 24 and from 203.96 ms to 83.06 ms on Node 26. Unique loaded ESM modules drop from 181 to 58.The signal is intentionally scoped to light CLI startup. A full
list:routesboot improves by 4.0% on Node 24 and 1.8% on Node 26, where timing distributions overlap. A real test run was inconclusive, so this does not claim faster tests or production server startup.Resolver tracing found two root imports during
ace --helpand six duringlist:routesbefore the consumer changes, and none afterward.Validation
npm run buildnpm run typecheckaddandconfiguretests with the CI version of pnpm