audio_config: search sparse markers efficiently (AUDIO-CONFIG-SCAN-SEARCH) #1136
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1136"
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?
Imported from ubiquitarianism/leonida. Originally posted by Taffyyy-ops on 2026-11-24T19:07:03Z.
Item ID:
AUDIO-CONFIG-SCAN-SEARCHSpeeds up sparse audio config scanning in
tools/audio_config.py:scan()by jumping directly between candidate markers withbytes.find(MARKER_1, ...)instead of slicing at every byte offset.Changes
tools/audio_config.py(scan): Replaces per-byteblob[pos:pos + 2] == MARKER_1checks withpos = 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 (ObservedBytesslice count) and parity tests comparing valid/overlapping/truncated markers against expected scan results.Verification
python -I scripts/check_no_game_data.py).Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T19:14:28Z.
Review: APPROVED
Reviewed and verified. Replaces naive byte-by-byte slicing with C-accelerated
bytes.find(MARKER_1, ...)intools/audio_config.py:scan(), drastically reducing search overhead across sparse audio configurations. Verified with synthetic unit testtests/test_audio_config_scan_search.py. 100% clean-room.Imported from ubiquitarianism/leonida. Originally posted by Deedlyy on 2026-11-24T20:14:25Z.
Recommendation: [MERGE]
Reasoning:
audio_config.scanusesbytes.findto 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 withmain. Merge once the queued checks are green.Impact level: 2/10
Imported from ubiquitarianism/leonida. Originally posted by Taffyyy-ops on 2026-11-25T10:45:06Z.
@abnalstlll-byte @Deedlyy Thanks for the review and
[MERGE]recommendation! Updated the PR description with a full summary of thebytes.find(MARKER_1, ...)change intools/audio_config.pyandtests/test_audio_config_scan_search.py.Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T22:35:27Z.
#1136 | head
92d90a0360(merged cleanly with mainadfb3821a2) |python -I tests/test_audio_config_scan_search.py -v+python -I tests/test_audio_config.py -v+ 16 MiB sparse scan benchmark | red on main:FAILED (failures=1)(AssertionError: 99977 not less than 10byte-by-byte slices on a 100 KB sparse buffer; 16 MiB sparse scan took2,320.85 ms) | green on PR+main:2 ran, OK(test_audio_config_scan_search.py),23 ran, OK(test_audio_config.py), and 16 MiB sparse scan dropped from2,320.85 msto5.88 ms(395xfaster) | Windows 11 (10.0.26200.9974), Python 3.12.10 | AI-assisted: yesAudited
92d90a0360(tools/audio_config.pyandtests/test_audio_config_scan_search.py) on Windows 11 — first execution of this PR — confirmingblob.find(MARKER_1, pos, end + 2)matchesscan_stream'send + 2window bound so a marker atpos == endwith 20 trailing bytes is still found identically across chunk boundaries. Also verifiedtests/test_ci_registration.py,tests/test_text_write_line_endings.py, andscripts/check_no_game_data.py.Imported from ubiquitarianism/leonida. Originally posted by enlight3d on 2026-11-29T00:44:02Z.
RUN for #1136 (red/green, synthetic inputs only, no build, no game, GPU not used)
Heads tested
92d90a0360829530dbd0(origin/main at the time of the run)git merge --no-edit --no-ff(local only, merge was clean, nothing pushed)Commands (one process per file, from the repo root, CPython 3.13.12 with -I)
Red: tests kept, the PR's change to tools/ reverted to the merge base. work-count (performance) red: with tools/audio_config.py reverted, the sparse-input test fails ("99977 not less than 10" slices), while the parity test passes on both sides (the change keeps scan results identical).
Green at PR head: yes (tests/test_audio_config_scan_search.py: 2 passed; test_audio_config.py: 22 passed at head / 23 merged (main has one more test); test_bad_input_errors.py: 11; test_docs_repo_paths.py: 3 at head / 5 merged; test_joaat_agreement.py: 2; test_missing_input_exit_codes.py: 2)
Green merged into main: yes, same files all pass on the merged tree (counts as above)
Plain main (other covering tests, without the PR): pass, so nothing pre-existing fails and nothing breaks once merged.
Kind of red: work count + parity (refactor with a performance test).
Machine: Windows 11 Pro 10.0.26300, CPython 3.13.12; GPU not used.
Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-29T08:54:16Z.
@Taffyyy-ops this PR is green on
main+ PR (red/green runs posted above by zmasi and enlight3d). The only thing missing for a merge is your claim of its item in the coordination issue #2570. Once it is there, a maintainer can merge it. (This is a one-time note on each of your green PRs: #1115 #1119 #1124 #1136 #1142 #1159.) — OreoFR's agent (AI-assisted)Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T14:38:00Z.
Merged at head
92d90a0. Tested on this head by enlight3d, zmasi: the new test fails on main and passes with the PR (results in the comments above). AI-assisted: yes.