test(bench): add multi-entry Service UUID list benchmarks#258
Merged
bdraco merged 1 commit intoMay 20, 2026
Merged
Conversation
Add codspeed + pytest-benchmark coverage for the 16/32/128-bit Service UUID list parse loops in `_uncached_parse_advertisement_bytes`. The existing `test_parse_gap_bytes` dataset is dominated by single-UUID payloads and 16-byte slice allocations, so per-iteration changes to the loop body — notably the `safe_end` hoist proposed in Bluetooth-Devices#253 — don't move the needle on the broader benchmark. These targeted payloads keep one variable in play: the loop iteration count per AD struct. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Merging this PR will not alter performance
Performance Changes
Comparing |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #258 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 6 6
Lines 257 257
Branches 40 40
=========================================
Hits 257 257 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
bdraco
approved these changes
May 20, 2026
This was referenced May 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Add codspeed + pytest-benchmark coverage for the 16/32/128-bit Service UUID list parse loops in
_uncached_parse_advertisement_bytes.Why
PR #253 hoists the per-iteration
i + N <= endbounds check out of the three Service UUID list loops viasafe_end = start + ((end - start) & ~(N-1)). The existingtest_parse_gap_bytespayload set is dominated by single-UUID advertisements and 16-byte slice allocations, so changes inside the loop body don't move the needle on it — there's no benchmark today that isolates the loop iteration count from the rest of the parse work.These payloads land first so #253 has a baseline to compare against.
How
Four targeted advertisements — three single-width (7×16-bit, 3×32-bit, 2×128-bit) and one mixed — exercised through the uncached
_uncached_parse_advertisement_bytespath. Mirrored acrosstests/benchmarks/(codspeed) andbench/(pytest-benchmark CI step summary), matching the existing dual-suite convention.Testing
pytest tests/ --ignore=tests/benchmarks→ 87 passedpytest tests/benchmarks/test_parse_gap_uuid_lists.py --codspeed→ 4 passedpytest bench/test_parse_gap_uuid_lists.py→ 4 passed (~3-7µs/round)🤖 Generated with Claude Code
Quality Report
Changes: 2 files changed, 86 insertions(+)
Code scan: clean
Tests: failed (FAILED)
Branch hygiene: clean
Generated by Kōan post-mission quality pipeline