perf: lazy-load token burden command - #35
Open
infectiousstupidity wants to merge 1 commit into
Open
infectiousstupidity wants to merge 1 commit into
infectiousstupidity wants to merge 1 commit into
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.
Fixes #33.
Alternative implementation to #34.
Problem
pi-token-burdencurrently loads the full command dependency graph when the extension itself is loaded, even when/token-burdenis never used.This includes relatively expensive modules such as the tokenizer, report UI, skill handling, and extension-analysis code, adding unnecessary cost to normal Pi startup.
Change
Keep the extension entrypoint lightweight and move the
/token-burdenimplementation intorunTokenBurden.ts.index.tsnow only:/token-burdenrunTokenBurdenwhen the command is invokedThis creates one explicit lazy-loading boundary so future command-only dependencies naturally remain off the startup path.
Tests verify that the command module is not evaluated during extension registration, then loads and delegates correctly when
/token-burdenis invoked. The existing active-tool/envelope behavior test is retained with the extracted command implementation.Validation
pnpm run checkpasses in a clean Linux checkout on Node 22, including all 213 unit tests.Scope
This PR intentionally contains only the startup lazy-loading change. It does not include the other performance work from my fork.