Public Access
Gemini: count the App's per-line tables in the page budget
Found in M3 while checking floors with the radio on: a windowed page left 1.5 to 3 KB less than the 40 KB steady floor (Q86), radio or not. The budget counted TextBuffer's index (8 B/line) but not the App's tables, which also grew by doubling. Now 16 B/line, and the App sizes them exactly. The FAQ (1051 lines, windowed): 38.5 -> 39.6 KB after, radio asleep; 37.1 -> 39.0 KB with the radio listening. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EhqxQ49eCju4CzKYNjZzwT
This commit is contained in:
@@ -103,8 +103,11 @@ void GeminiApp::show(GeminiPage&& page) {
|
||||
}
|
||||
|
||||
void GeminiApp::analyse() {
|
||||
types_.clear();
|
||||
links_.clear();
|
||||
// Sized exactly: the Service budgeted these bytes per line (kBytesPerLine), growth by
|
||||
// doubling would take up to twice that.
|
||||
std::vector<uint8_t>().swap(types_);
|
||||
std::vector<uint32_t>().swap(links_);
|
||||
types_.reserve(page_.text.lineCount());
|
||||
// A window may start inside a preformatted block: the index says (bit 31).
|
||||
size_t entry = page_.windowStart / GeminiService::kIndexEvery;
|
||||
bool pre = page_.windowed && entry < page_.lineIndex.size() && (page_.lineIndex[entry] & 0x80000000u);
|
||||
@@ -114,6 +117,7 @@ void GeminiApp::analyse() {
|
||||
types_.push_back(static_cast<uint8_t>(t));
|
||||
if (t == LineType::Link) links_.push_back(i);
|
||||
}
|
||||
links_.shrink_to_fit();
|
||||
layoutDirty_ = true;
|
||||
requestRedraw();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user