Repository navigation
Conversation
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.
Change
One copy-on-write dispatch snapshot is rebuilt under the existing lock during
subscribe(),update(), orcancel()._dispatch()iterates it directly, with no per-event lock or snapshot allocation. A pre-normalizedfrozensetalso avoids redundant normalization. Cancellation remains checked immediately before invoking the callback.Only
lib/subscribable.pychanges in the runtime. The added GitHub Actions workflow provides a reproducible same-runner benchmark.Verified direct-dispatch performance
7 alternating rounds x 100,000 operations, same Python 3.11 runner, both baselines installed separately. Full benchmark run.
Both Python 3.11 and 3.12 standard test jobs passed: CI run.
Concurrency
The immutable tuple freezes the identifier view for each dispatch.
update()publishes a replacement tuple under the existing lock.cancel()marks the registration inactive and removes it from future tuples. Checking_activeimmediately before callback invocation preserves the previously agreed nonblocking/best-effort in-flight semantics. It does not claim a strict no-new-start-after-return guarantee in the narrow race between checking the flag and calling the callback.No O or Web source files changed.