Repository navigation
fix(measure): read a phone page's trim and its byte budget apart - #875
Merged
Merged
Conversation
The phone-page measurement compared the two clients' delivered bytes directly and asserted the lean page was never larger. That is false whenever the 512 KiB budget cuts one page and not the other, because the budget sheds whole oldest exchanges: on a real session page the undeclared client was cut to 77 of the 805 entries the phone asked for, while the lean page fit and was delivered whole — 280 KiB against 130 KiB. The lean page is larger there precisely because it still holds the exchanges the other had to drop, which is the outcome the trim is for. The assertion made that look like a regression and the report printed a negative "saved" as if the trim had cost bytes. Now the two effects are measured apart: the trim with and without the budget (the only like-for-like comparison, and where `saved` comes from), and what each client actually receives. The invariant asserted is the one that holds — the lean page never delivers fewer entries than the undeclared one. Measured on six real sessions, the trim is -73.0% to -83.0% of the requested page, and in three of them the undeclared client's page is truncated while the lean one is whole (97 vs 825 entries, 279 vs 325, 276 vs 600). Also fixes measure-live-lane.py picking its test binary alphabetically rather than by mtime: target/debug/deps keeps every historical build, so a stale one silently measures the trims of another commit and reports plausible numbers. That is how a measurement run here reported the state from four PRs earlier (0.76 MB where the current lane is 0.19 MB). Docs: CONNECTION.md's history-page table was built from the mixed comparison and is replaced with the separated one.
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 two measurement defects that produced wrong numbers, one of which is in a documented claim.
1. The phone-page measurement compared incomparable pages
measure_phone_pagebuilt the undeclared and lean pages and asserted the lean one was never larger — then reportedsaved = 1 - lean/undeclared. That is false whenever the 512 KiB budget cuts one page and not the other, because the budget sheds whole oldest exchanges.On a real session page:
The undeclared client was cut to 77 of the 805 entries the phone asked for; the lean page fit and arrived whole. The lean page is larger there precisely because it still holds the exchanges the other had to drop — the outcome the trim exists for. The assertion called that a regression, and the report printed a negative "saved", as if the trim had cost bytes.
Two effects, now measured apart:
savedcomes from.The asserted invariant is the one that actually holds: the lean page never delivers fewer entries than the undeclared one.
Measured on six real sessions: the trim is −73.0% to −83.0% of the requested page, and in three of the six the undeclared client's page is truncated while the lean one is whole (97 vs 825 entries, 279 vs 325, 276 vs 600).
Falsified: injecting an entry drop into the lean build makes it fail with
the lean page must not deliver fewer entries than the undeclared one (236 vs 235).2.
measure-live-lane.pypicked its binary alphabeticallytarget/debug/depskeeps every historical build of the test binary. The script tooksorted(...)[0], not the newest by mtime — so it silently measured the trims of an older commit and printed plausible numbers. A run here reported 0.76 MB where the current lane is 0.19 MB (the state from four PRs earlier). The other measurement scripts already select by mtime; only this one did not.Docs
CONNECTION.md's history-page table was built from the mixed comparison (it claimed 69.4% / 76.9% / 88.6% on a basis that measures nothing when the budgets differ). Replaced with the separated table plus the whole-session trim figures (−76.8% / −76.6% / −80.1%), and the note about why comparing raw bytes across the two clients is meaningless.Verification
Desktop backend 1325 passed / 0 failed;
cargo fmt --checkandcargo clippy --all-targets -D warningsclean;scripts/docs/check-docs.py(205 docs) clean. Both effects reproduced through the shipping trim and budget on real pages.No product behaviour changes — this is the instrument and the document about it.