perf: OAuth token cache, lazy command loading, parallel bulk load (#247) - #253
Merged
Conversation
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
|
Failed to generate code suggestions for PR |
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.
Summary
Three measured performance improvements: per-context OAuth token cache (no auth roundtrips on consecutive commands), lazy command loading (startup -74%), and concurrent bulk loads.
Metrics (same method as baseline: /usr/bin/time -p, 5 runs, .venv/bin/scm)
scm --versionwallscm --helpwallimport scm_cli.mainChanges
utils/token_cache.py: per-context cache in~/.scm-cli/cache/(0600), 5-min expiry buffer, corrupt-tolerant,SCM_NO_TOKEN_CACHE=1kill-switch; SCMClient reuses valid tokens via bearer-mode session, auto-supplies commit admin, clears cache when the API rejects a tokenmain.py: lazy TyperGroup — help listings render from static metadata, modules import only on dispatch;importlib.metadatadeferred into --versionutils/bulk.py+ all 72 non-order-sensitive load commands migrated torun_bulk(5 workers,SCM_BULK_WORKERS); security/NAT/PBF/QoS rule loads and folder hierarchy load stay sequential to preserve orderingTesting
Notes
scm <group> --helpfor a specific category still imports that category's module (dispatch), which is the desired boundaryChecklist
Closes #247
🤖 Generated with Claude Code