Fix: Trace mode performance regressions#245
Open
griffinmilsap wants to merge 6 commits intodevfrom
Open
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.
Summary
Optimizes profiling trace hot-path overhead, especially for dashboard-style trace mode, by reducing Python-level bookkeeping work on publisher and subscriber message paths.
What changed
ProfilingTraceSampleat the public API boundary, but removed per-sample dataclass creation from the publisher/subscriber hot pathdequebufferssample_mod == 1fast path to skip unnecessary sampling counter/modulus work in the common dashboard casebroadcast()ProfilingTraceSampleshapePerformance notes
Validation
tests/test_profiling_api.py::test_subscriber_trace_sampling_uses_one_decision_per_messagetests/test_perf_hotpath.pytests/test_perf_ab.pyezmsg perf ab --trace --force-shared-envagainstdev/baseline runs showed consistent improvements across most traced hotpath cases.Benchmark summary
ezmsg perf ab --trace --force-shared-envcomparingdevvsfix/trace-perfshowed the clearest gains on the local traced hotpath:async/local/payload=4096:6.05 -> 5.43 us/msg(-10.36%,6/6wins)async/local/payload=64:6.10 -> 5.34 us/msg(-12.19%,6/6wins)async/shm/payload=64andasync/tcp/payload=64async/shm/payload=4096andasync/tcp/payload=4096ezmsg perf hotpathruns show trace overhead remains concentrated on the local path, but at a lower absolute level than the earlier baseline:4.89-4.92 us/msg5.21-5.26 us/msgasync/local/payload=4096:5.26 us/msgasync/local/payload=64:5.21 us/msgasync/shm/payload=4096:76.65 us/msgasync/shm/payload=64:74.44 us/msgasync/tcp/payload=4096:74.20 us/msgasync/tcp/payload=64:72.14 us/msg