perf: compact merged write intervals in place #1232

Open
github-bot wants to merge 2 commits from github-bot/gh-1232 into main AGit
Owner

@⁠spk-c on GitHub · 2026-11-26 00:59 UTC · original
spk-c:submit/interval-compaction → main · +47 −6 · 1 files · 2 commits · open

Summary

Sort and compact the write interval vector in place instead of allocating an output vector. Preserve the reference implementation's merged interval semantics. Includes deterministic randomized parity regression. Does not include the superseded write-index experiment.

Validation

All CI steps passed for this isolated change against the corrected test baseline in the fork: https://github.com/spk-c/victory-fork/actions/runs/45731813852.

This submission is a single commit rebased onto upstream a183ea2; exact-revision upstream CI is pending. Upstream's pre-existing CI failures are addressed separately in #1228. Draft pending baseline and upstream review. AI-assisted.

Independent validation

Yoshi-233's report tested exact head 9a04be5 and two reference revisions in a standalone Linux CPU harness: 1,679,616 interval-union cases per revision matched the reference, including a separate usize::MAX boundary case. Repeated covered-range updates caused zero allocations on the PR vs 10,000 on each reference. Trade-off: a collapsed large set retained capacity 4,097 vs 1 on references. No gameplay or process-memory measurement.

Refresh against upstream 52ac4ec

New head 783abdd1a3fa9c3f1553a5a57d0be36aec8694cf; in-place interval compaction matched the allocating reference in the focused regression. Clean isolated workspace Cargo Check and strict all-feature Clippy passed. Original commits are preserved. PR-only diff check passed. Full upstream CI approval and source-size policy fix #1357 remain pending.

**@⁠spk-c** on GitHub · 2026-11-26 00:59 UTC · [original](https://github.com/fxceless/victory-fork/pull/1232) `spk-c:submit/interval-compaction` → `main` · +47 −6 · 1 files · 2 commits · open ## Summary Sort and compact the write interval vector in place instead of allocating an output vector. Preserve the reference implementation's merged interval semantics. Includes deterministic randomized parity regression. Does not include the superseded write-index experiment. ## Validation All CI steps passed for this isolated change against the corrected test baseline in the fork: https://github.com/spk-c/victory-fork/actions/runs/45731813852. This submission is a single commit rebased onto upstream a183ea2; exact-revision upstream CI is pending. Upstream's pre-existing CI failures are addressed separately in #1228. Draft pending baseline and upstream review. AI-assisted. ## Independent validation [Yoshi-233's report](https://git.gtahub.st/github/fxceless--victory-fork/pulls/1232) tested exact head `9a04be5` and two reference revisions in a standalone Linux CPU harness: 1,679,616 interval-union cases per revision matched the reference, including a separate usize::MAX boundary case. Repeated covered-range updates caused zero allocations on the PR vs 10,000 on each reference. Trade-off: a collapsed large set retained capacity 4,097 vs 1 on references. No gameplay or process-memory measurement. ## Refresh against upstream 52ac4ec New head `783abdd1a3fa9c3f1553a5a57d0be36aec8694cf`; in-place interval compaction matched the allocating reference in the focused regression. Clean isolated workspace Cargo Check and strict all-feature Clippy passed. Original commits are preserved. PR-only diff check passed. Full upstream CI approval and source-size policy fix #1357 remain pending.
Isolated contribution based on a183ea2. AI-assisted.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:00:02 +00:00
Author
Owner

@⁠Yoshi-233 on GitHub · 2026-11-26 01:21 UTC · original

I independently tested join_ranges from the parent (a183ea2), current main (c9092ec) and the PR (9a04be5) on x86-64 Linux with Rust 1.98.1. I compiled the function body from each revision into the same CPU harness.

  • For every starting occupancy mask over eight slots, I added every ordered pair of intervals with endpoints 0 through 8, including empty and reversed intervals. All 1,679,616 results per revision matched an independent bitmap union converted back to canonical half-open intervals. A separate case with overlapping and touching ranges ending at usize::MAX also passed.
  • With room already reserved, I repeatedly inserted the covered interval [1, 3) into [(0, 4), (8, 10)]. A counting allocator saw 10,000 allocation/reallocation calls across 10,000 updates on both the parent and main, and zero on the PR.
  • The other side of that reuse is retained capacity. Starting with capacity 4,097 and 4,096 disjoint ranges, I merged them into one with a covering interval, then issued an empty update. The parent and main ended with capacity 1; the PR retained 4,097 slots. The resulting interval was identical in each case.

These are allocator counts and correctness checks on synthetic inputs. I did not measure in-game frame time or process memory.

**@⁠Yoshi-233** on GitHub · 2026-11-26 01:21 UTC · [original](https://github.com/fxceless/victory-fork/pull/1232#issuecomment-7179692367) I independently tested `join_ranges` from the parent (`a183ea2`), current main (`c9092ec`) and the PR (`9a04be5`) on x86-64 Linux with Rust 1.98.1. I compiled the function body from each revision into the same CPU harness. - For every starting occupancy mask over eight slots, I added every ordered pair of intervals with endpoints 0 through 8, including empty and reversed intervals. All 1,679,616 results per revision matched an independent bitmap union converted back to canonical half-open intervals. A separate case with overlapping and touching ranges ending at `usize::MAX` also passed. - With room already reserved, I repeatedly inserted the covered interval `[1, 3)` into `[(0, 4), (8, 10)]`. A counting allocator saw 10,000 allocation/reallocation calls across 10,000 updates on both the parent and main, and zero on the PR. - The other side of that reuse is retained capacity. Starting with capacity 4,097 and 4,096 disjoint ranges, I merged them into one with a covering interval, then issued an empty update. The parent and main ended with capacity 1; the PR retained 4,097 slots. The resulting interval was identical in each case. These are allocator counts and correctness checks on synthetic inputs. I did not measure in-game frame time or process memory.
AI-assisted: keep original tested commit in history; local all-feature check, strict Clippy and focused synthetic tests passed. Upstream asset-policy baseline remains open (#1357).
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1232/head:github-bot/gh-1232'
git switch 'github-bot/gh-1232'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1232'
git switch 'github-bot/gh-1232'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1232'
git switch 'github-bot/gh-1232'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1232'
git switch 'main'
git merge --squash 'github-bot/gh-1232'
git switch 'main'
git merge --ff-only 'github-bot/gh-1232'
git switch 'main'
git merge 'github-bot/gh-1232'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.