Reuse refresh workers and skip redundant page scans #396

Closed
github-bot wants to merge 660 commits from github-bot/gh-396 into main AGit
Owner

@⁠Boneless-Sans on GitHub · 2026-11-28 04:19 UTC · original
Boneless-Sans:codex/texture-queue-refresh → main · +60028 −5438 · 206 files · 660 commits · closed without merging

Changes

  • Use the refresh pool’s existing worker count for indexed jobs.
  • Run single-index jobs inline and skip empty jobs without allocating.
  • Reuse the populated-page check already made under the copy lock, keeping the write journal check for all pages.

The texture-queue and per-view-heap notification changes needed for the older local renderer are already in the upstream default branch.

**@⁠Boneless-Sans** on GitHub · 2026-11-28 04:19 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/396) `Boneless-Sans:codex/texture-queue-refresh` → `main` · +60028 −5438 · 206 files · 660 commits · closed without merging ## Changes - Use the refresh pool’s existing worker count for indexed jobs. - Run single-index jobs inline and skip empty jobs without allocating. - Reuse the populated-page check already made under the copy lock, keeping the write journal check for all pages. The texture-queue and per-view-heap notification changes needed for the older local renderer are already in the upstream default branch.
GitHub main already selects only the needed slots from the texture queue. This applies the separate refresh optimization tested on the earlier renderer.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 04:22:33 +00:00
Author
Owner

@⁠safesearch77 on GitHub · 2026-11-28 13:27 UTC · original

I read this against main (fe7c6e5) and the changes look correct to me.

  • unchanged_since_copy dropping taken.iter().all(|&at| at != 0): this is redundant. CopiedPages keeps uncopied_bits set exactly when at[i] == 0, and only set() writes at. The caller's range_all_copied(from / PAGE - base, (to - 1) / PAGE - base) covers the same pages as taken = at[first - base .. ceil(to / PAGE) - base], under the same ranged != 0 || condition.
  • Small suggestion: the function is pub(crate) and now depends on that caller check. A debug_assert!(ranged != 0 || taken.iter().all(|&at| at != 0)) would keep the precondition visible without costing anything in release builds.
  • wide_each with n < 2: no behaviour change. wide() already runs a single job inline, so this saves the Arc and Box. Using workers().thread_count gives the same value as wide_threads() without calling available_parallelism on every call.

No CI run is attached yet. Since Shadow::nothing_new is on the refresh path (most refreshes there copy nothing), a before/after of the refresh time in the submitting thread's frame line would show what it is worth.

**@⁠safesearch77** on GitHub · 2026-11-28 13:27 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/396#issuecomment-7239945538) I read this against `main` (`fe7c6e5`) and the changes look correct to me. - **`unchanged_since_copy` dropping `taken.iter().all(|&at| at != 0)`:** this is redundant. `CopiedPages` keeps `uncopied_bits` set exactly when `at[i] == 0`, and only `set()` writes `at`. The caller's `range_all_copied(from / PAGE - base, (to - 1) / PAGE - base)` covers the same pages as `taken = at[first - base .. ceil(to / PAGE) - base]`, under the same `ranged != 0 ||` condition. - **Small suggestion:** the function is `pub(crate)` and now depends on that caller check. A `debug_assert!(ranged != 0 || taken.iter().all(|&at| at != 0))` would keep the precondition visible without costing anything in release builds. - **`wide_each` with `n < 2`:** no behaviour change. `wide()` already runs a single job inline, so this saves the `Arc` and `Box`. Using `workers().thread_count` gives the same value as `wide_threads()` without calling `available_parallelism` on every call. No CI run is attached yet. Since `Shadow::nothing_new` is on the refresh path (most refreshes there copy nothing), a before/after of the refresh time in the submitting thread's frame line would show what it is worth.
Author
Owner

@⁠TaynanGT on GitHub · 2026-11-29 11:37 UTC · original

Thanks for checking the caller invariant against the actual CopiedPages representation. A debug assertion documenting that precondition makes sense. I'd like the submitting-thread refresh timing measured on matched runs, with copied bytes held comparable.

**@⁠TaynanGT** on GitHub · 2026-11-29 11:37 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/396#issuecomment-7255237368) Thanks for checking the caller invariant against the actual CopiedPages representation. A debug assertion documenting that precondition makes sense. I'd like the submitting-thread refresh timing measured on matched runs, with copied bytes held comparable.
github-bot closed this pull request 2026-11-30 17:14:33 +00:00
Author
Owner

@⁠TaynanGT on GitHub · 2026-11-30 17:09 UTC · original

main has moved to a new line of the code and everything is now named Vice-Tay, so this PR no longer applies as it is (details in #468). If you'd like this change in, please rebuild it on the current main and open a new PR; I'll review it there.

**@⁠TaynanGT** on GitHub · 2026-11-30 17:09 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/396#issuecomment-7285813702) `main` has moved to a new line of the code and everything is now named Vice-Tay, so this PR no longer applies as it is (details in #468). If you'd like this change in, please rebuild it on the current `main` and open a new PR; I'll review it there.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.