Repository navigation
perf(line): the asm cache is in the image, not read at the first prompt - #229
Merged
Merged
Conversation
The first Lexer make in a process imports x/tool/asm-cache, and python/line makes its lexer lazily at a terminal session's first prompt. Nothing imported the module where the image is written, so every terminal session read it from source under the numeric tower's reader: in x-os's container (a 3.7 GB podman VM) the banner printed, memory climbed past 1.4 GB, and the session was killed with no prompt. Piped sessions never make the lexer and were unaffected. x-lang's Lexer doc names this cost and this remedy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
On a terminal,
pythonprinted its banner and never drew a prompt in x-os's container. Memory climbed past 1.4 GB, and the 3.7 GB podman VM killed it after about 24 s. With piped stdin it answers in 1.3 s.The terminal path is the difference.
python/line.xmakes its lexer, for painting and bracket marks, at the first prompt, and the firstLexer makein a process importsx/tool/asm-cache. Nothing imported that module where the image is written, so each terminal session read it from source under the numeric tower's reader. x-lang'sLexerdoc names this cost and says to importx/tool/asm-cachewhere the image is written. This PR does that inpython/line.x.Companion: jonruttan/x-os#83 adds a python session to x-os's
warm.exp, so the lexer's compiled states are also in the image's code cache.Not yet measured. A local before/after (time to first
>>>on a tty, peak RSS, on x-lang v0.44.0) is queued behind the host's memory gate. I'll post the numbers here when it runs.🤖 Generated with Claude Code