Repository navigation
perf(cli): avoid eager terminal width setup at startup - #757
Merged
Merged
Conversation
Every command paid for building Unicode width tables before it could run, even version and help. Use the upstream lazy initialization fix to remove that work from commands that do not need it. On Linux, the measured median version invocation fell from 46.6 ms to 21.9 ms. Keep a subprocess benchmark because in-process command benchmarks miss package initialization and would not reveal this regression. Generated with Codex Co-authored-by: Codex <noreply@openai.com>
roborev: Combined Review (
|
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.
Speeds up CLI commands by removing unnecessary terminal-width setup at process startup. The existing dependency eagerly built Unicode lookup tables even for
docbank version. Updating go-runewidth from v0.0.27 to v0.0.30 picks up the upstream lazy-initialization fix.Measured medians on Linux/amd64 with CGO SQLite and warm filesystem caches:
docbank versiondocbank ls /with a running daemonaddinvocations, one 1 KiB file eachaddinvocation with all 128 filesStartup measurements use 40 invocations per binary; listing uses 60. Import measurements use three runs per case, with unique synthetic content and fresh vaults. Source generation and daemon startup are excluded from import timing. The bulk comparison shows why passing multiple paths or a directory is still much faster than launching a process per file.
BenchmarkCLIStartupmeasures real subprocesses so future investigations include package initialization. This addresses startup on current main, not the original v0.14.0 directory-scaling problem; these are not M2 measurements.