Skip to content

test(bench): add multi-entry Service UUID list benchmarks#258

Merged
bdraco merged 1 commit into
Bluetooth-Devices:mainfrom
bluetoothbot:koan/bench-gap-uuid-lists
May 20, 2026
Merged

test(bench): add multi-entry Service UUID list benchmarks#258
bdraco merged 1 commit into
Bluetooth-Devices:mainfrom
bluetoothbot:koan/bench-gap-uuid-lists

Conversation

@bluetoothbot

@bluetoothbot bluetoothbot commented May 20, 2026

Copy link
Copy Markdown
Contributor

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 <= end bounds check out of the three Service UUID list loops via safe_end = start + ((end - start) & ~(N-1)). The existing test_parse_gap_bytes payload 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_bytes path. Mirrored across tests/benchmarks/ (codspeed) and bench/ (pytest-benchmark CI step summary), matching the existing dual-suite convention.

Testing

  • pytest tests/ --ignore=tests/benchmarks → 87 passed
  • pytest tests/benchmarks/test_parse_gap_uuid_lists.py --codspeed → 4 passed
  • pytest 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

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>
@codspeed-hq

codspeed-hq Bot commented May 20, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 11 untouched benchmarks
🆕 4 new benchmarks

Performance Changes

Benchmark BASE HEAD Efficiency
🆕 test_parse_advertisement_16bit_uuid_list N/A 23.1 µs N/A
🆕 test_parse_advertisement_32bit_uuid_list N/A 20.3 µs N/A
🆕 test_parse_advertisement_mixed_uuid_lists N/A 29.1 µs N/A
🆕 test_parse_advertisement_128bit_uuid_list N/A 20.4 µs N/A

Comparing bluetoothbot:koan/bench-gap-uuid-lists (4169d81) with main (a069b29)

Open in CodSpeed

@codecov

codecov Bot commented May 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (a069b29) to head (4169d81).
⚠️ Report is 1 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@bdraco bdraco marked this pull request as ready for review May 20, 2026 12:23
@bdraco bdraco merged commit b8f4b62 into Bluetooth-Devices:main May 20, 2026
49 checks passed
@bluetoothbot bluetoothbot deleted the koan/bench-gap-uuid-lists branch May 20, 2026 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants