Repository navigation
rt: a Console capture reuses its buffer and returns a tight copy (s2c self-compile: page faults -86%, peak -30 MB) - #101
Merged
Merged
Conversation
… returns its text as a tight copy; before, every capture kept a fresh 4 KiB malloc block for the program's lifetime (s2c self-compile, 7,468 captures in Mem.fresh: page faults 8,617 -> 1,214, peak RSS 417.5 -> 387.9 MB, same output). Test prog/capture_many: 20,000 captures keep the peak flat and the first text intact
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.
What
A
Consolecapture (captureBegin..captureEnd) reuses the buffer of the last ended capture and returns its text as a tight copy. Before,rt_capture_beginstarted every capture on a fresh malloc block (4 KiB) that lived until the program ended.Why
s2c compiling itself captures 7,468 times (
Mem.freshbuilds the namex#nwith a capture). Those blocks were 86% of its page faults and 30 MB of its peak:Measured first as a stub on a scratch copy of the runtime, then landed as the same change (ticket in vic/evidence).
Test
tests/s2/prog/capture_many.srs: 20,000 short captures; the peak RSS (VmHWM) after them must stay under twice the peak after the first 100, and the first captured text must still readx#0at the end. Old runtime:grew(81.9 MB, 20,314 faults). New:flat,kept(3.1 MB, 391 faults).Mutants, both killed by the test: no buffer reuse (
grew); returning the shared buffer instead of a copy (lost).Gate: tests/run.sh green on this tree (log in the PR checks).