Look up views once per range in watch::writing, and drop ended pins #67
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Belobug--VIctory-Belobug-AMD!67
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-67"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@romainhedouin on GitHub · 2026-11-25 13:16 UTC · original
romainhedouin:perf/watch-writing-one-lock→main· +29 −15 · 1 files · 1 commits · closed without mergingwatch::writingruns for every copy into title memory, every copy-back, every readback row, everyReadFileand every raw DirectStorage request. For each 64 KiB block of the range it locked the views table and copied that block's list of views into a newVec, even for pages with a single view that it then skipped. It now locks the views table once for the whole range and only collects the other views of pages that have several. It also drops pins that have ended when adding a new one (they end in the order they are made, so this is a pop from the front); before, they were only dropped on the slow path ofguard()and could pile up, making every pin check scan them. Same pins, same blocks opened.writing()call over N blocks"Model benchmark" = the same logic copied into a standalone program and timed in release mode on a Mac, not in the game. The model asserts identical pins and opened blocks for the old and new code. Type-checked for Windows (
cargo clippy --target x86_64-pc-windows-msvc, with and without--all-features, no new warnings); not run.🤖 Generated with Claude Code
@ -663,0 +661,4 @@// at the views for the whole range, and a list only of the other views of// pages with several (a lock and a list for each block before, which// every copy into title memory waited for under the guards' lock).let others = {@gut0to on GitHub · 2026-11-25 15:08 UTC · original
The existing alias tests write through a mapped view and exercise the exception path, but they do not call writing() on a range spanning aliased blocks. Could one test verify that this bulk alias collection leaves each corresponding other view writable and reports it on the next guard check? AI-assisted review; I checked the changed range walk against the existing alias tests.
@gut0to on GitHub · 2026-11-25 15:08 UTC · original · reviewed
AI-assisted review: I checked the changed behavior and the associated test coverage.
@romainhedouin on GitHub · 2026-11-26 22:24 UTC · original
Closing: on
a-publier,watch::writingno longer pins or walks views block by block. It takes the guards' lock only when thePROTECTEDbitmap shows a protected block (watch.rs:3222).Pull request closed