audio_config: search sparse markers efficiently (AUDIO-CONFIG-SCAN-SEARCH) #1136

Open
github-bot wants to merge 1 commit from github-bot/gh-1136 into main AGit
Owner

@⁠Taffyyy-ops on GitHub · 2026-11-24 19:07 UTC · original
Taffyyy-ops:fix/audio-config-scan-search → main · +55 −1 · 2 files · 1 commits · open

Item ID: AUDIO-CONFIG-SCAN-SEARCH

Speeds up sparse audio config scanning in tools/audio_config.py:scan() by jumping directly between candidate markers with bytes.find(MARKER_1, ...) instead of slicing at every byte offset.

Changes

  • tools/audio_config.py (scan): Replaces per-byte blob[pos:pos + 2] == MARKER_1 checks with pos = blob.find(MARKER_1, pos, end + 2), preserving exact record parsing and non-matching advancement (pos += 1).
  • tests/test_audio_config_scan_search.py: Adds synthetic sparse-input work checks (ObservedBytes slice count) and parity tests comparing valid/overlapping/truncated markers against expected scan results.

Verification

  • AI-assisted; synthetic tests only, no game data (python -I scripts/check_no_game_data.py).
**@⁠Taffyyy-ops** on GitHub · 2026-11-24 19:07 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1136) `Taffyyy-ops:fix/audio-config-scan-search` → `main` · +55 −1 · 2 files · 1 commits · open Item ID: `AUDIO-CONFIG-SCAN-SEARCH` Speeds up sparse audio config scanning in `tools/audio_config.py:scan()` by jumping directly between candidate markers with `bytes.find(MARKER_1, ...)` instead of slicing at every byte offset. ### Changes - **`tools/audio_config.py` (`scan`):** Replaces per-byte `blob[pos:pos + 2] == MARKER_1` checks with `pos = blob.find(MARKER_1, pos, end + 2)`, preserving exact record parsing and non-matching advancement (`pos += 1`). - **`tests/test_audio_config_scan_search.py`:** Adds synthetic sparse-input work checks (`ObservedBytes` slice count) and parity tests comparing valid/overlapping/truncated markers against expected scan results. ### Verification - AI-assisted; synthetic tests only, no game data (`python -I scripts/check_no_game_data.py`).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:39:52 +00:00
Author
Owner

@⁠abnalstlll-byte on GitHub · 2026-11-24 19:14 UTC · original · approved these changes

Reviewed and verified. Replaces naive byte-by-byte slicing with C-accelerated bytes.find(MARKER_1, ...) in tools/audio_config.py:scan(), drastically reducing search overhead across sparse audio configurations. Verified with synthetic unit test tests/test_audio_config_scan_search.py. 100% clean-room.

**@⁠abnalstlll-byte** on GitHub · 2026-11-24 19:14 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1136#pullrequestreview-6045713532) · **approved these changes** Reviewed and verified. Replaces naive byte-by-byte slicing with C-accelerated `bytes.find(MARKER_1, ...)` in `tools/audio_config.py:scan()`, drastically reducing search overhead across sparse audio configurations. Verified with synthetic unit test `tests/test_audio_config_scan_search.py`. 100% clean-room.
Author
Owner

@⁠Deedlyy on GitHub · 2026-11-24 20:14 UTC · original

Recommendation: [MERGE]

Reasoning: audio_config.scan uses bytes.find to jump to the next marker instead of stepping byte by byte. Tool performance change with a parity test. Minimal PR description. CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict with main. Merge once the queued checks are green.

Impact level: 2/10

**@⁠Deedlyy** on GitHub · 2026-11-24 20:14 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1136#issuecomment-7143236703) **Recommendation:** [MERGE] **Reasoning:** `audio_config.scan` uses `bytes.find` to jump to the next marker instead of stepping byte by byte. Tool performance change with a parity test. Minimal PR description. CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict with `main`. Merge once the queued checks are green. **Impact level:** 2/10
Author
Owner

@⁠Taffyyy-ops on GitHub · 2026-11-25 10:45 UTC · original

@⁠abnalstlll-byte @⁠Deedlyy Thanks for the review and [MERGE] recommendation! Updated the PR description with a full summary of the bytes.find(MARKER_1, ...) change in tools/audio_config.py and tests/test_audio_config_scan_search.py.

**@⁠Taffyyy-ops** on GitHub · 2026-11-25 10:45 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1136#issuecomment-7160122937) @⁠abnalstlll-byte @⁠Deedlyy Thanks for the review and `[MERGE]` recommendation! Updated the PR description with a full summary of the `bytes.find(MARKER_1, ...)` change in `tools/audio_config.py` and `tests/test_audio_config_scan_search.py`.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
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/1136/head:github-bot/gh-1136'
git switch 'github-bot/gh-1136'

Merge

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