perf: improve CLI startup speed and local build speed - #2279
Draft
devxdh wants to merge 3 commits into
Draft
Conversation
Contributor
There was a problem hiding this comment.
Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our contributors guide useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.
|
devxdh
marked this pull request as ready for review
August 10, 2026 13:31
devxdh
requested review from
AayushSaini101,
Amzani,
Shurtu-gal,
Souvikns and
asyncapi-bot-eve
as code owners
August 10, 2026 13:31
devxdh
marked this pull request as draft
August 10, 2026 13:32
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.



Hello!
Since I hadn't gotten feedback on #2269 yet, I put together this Draft PR to show a working prototype of the startup speed improvements, along with a couple of quick build speed optimizations I found while working on it.
What's in this PR:
CLI Startup Speed (Lazy Loading)
@asyncapi/parserimport insrc/apps/cli/internal/base.tstoimport typeand added a lazy getter/loader. Now, running basic commands doesn't parse@asyncapi/parserright away.ValidationService,ValidationStatus, andConversionServiceinvalidate.tsandconvert.tsuntilrun()or diagnostic handlers execute.Local Build Speed (
tsc --incremental)"incremental": trueand"tsBuildInfoFile": "./.tsbuildinfo"totsconfig.json(and added.tsbuildinfoto.gitignore). This caches AST metadata sotscdoesn't re-compile all ~200 files from scratch on minor edits.Skipping Example ZIP Downloads on Build
scripts/fetch-asyncapi-example.jsto check ifassets/examples/examples.jsonalready exists locally before fetching the 2MB zip from GitHub. I also added aFORCE_FETCH_EXAMPLES=trueenvironment flag in case anyone wants to force a fresh download.Benchmarks (Tested on my machine)
npm run build): Dropped from ~19.75s down to ~6.15s (saving ~13.6 seconds per build).time ./bin/run_bin config): Dropped from ~2.37s down to ~1.76s.Question for Maintainers
Does skipping the spec example download when
examples.jsonalready exists locally look okay to you, or would you prefer a different flag/approach for fetching examples during builds?