Skip to content

Hot path optimizations#19

Merged
lesnik512 merged 3 commits intomainfrom
hot-path-optimizations
May 3, 2026
Merged

Hot path optimizations#19
lesnik512 merged 3 commits intomainfrom
hot-path-optimizations

Conversation

@lesnik512
Copy link
Copy Markdown
Member

No description provided.

lesnik512 and others added 2 commits May 3, 2026 17:13
…iddleware reflection

Replace per-iteration asyncio.wait fan-out across O(P) head tasks with a single
asyncio.Event set from each user task's done-callback (registered when the
committer absorbs the task). Pending lists are now maintained in offset order
via bisect.insort on the rare out-of-order arrival path, so _extract_ready_prefixes
no longer sorts on every commit. Drop redundant per-task exception logging in
_commit_partitions (handler's _finish_task already logs once with the right
context). Cache type(consumer).__name__ and _enable_auto_commit per-consumer in
a WeakKeyDictionary so the middleware doesn't re-evaluate on every message.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Removed in the same change that dropped per-task exception logging in
_commit_partitions — nothing reads MockAsyncioTask.exception() anymore.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@lesnik512 lesnik512 self-assigned this May 3, 2026
The test exited the drive loop on the first commit and asserted on the last call,
but depending on scheduling the streaming committer can issue a partial commit at
offset 11 (only fast0 done) before fast1 lands in pending. That partial commit
is correct behavior — across-batch pipelining streams whatever's done — but the
test was racing it against the assertion. Wait for the final outcome (offset 12)
to actually appear in the call history and use assert_any_call.

Surfaced as a Python 3.14 CI failure; the same race exists in 3.13 but lost the
coin flip less often.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@lesnik512 lesnik512 merged commit c0b5c21 into main May 3, 2026
5 checks passed
@lesnik512 lesnik512 deleted the hot-path-optimizations branch May 3, 2026 14:40
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.

1 participant