Repository navigation
perf: bring signal emission within C comparison target - #3657
Conversation
|
Checkpoint at
The draft preserves a focused, reviewed optimization with passing behavior tests. Full local lint is still running. PR CI41980826576 has no failures so far; Fast Gate and Linux Tier2 build remain active. Keep the PR draft until validation and repeatable measurements justify the next step. Local evidence artifacts: baseline |
Current master 75a8dd7: signal/emit/4 Rust mean138.56ns vs C86.23ns (1.607x), signal/emit_global/4 Rust215.51ns vs C84.91ns (2.538x); both exceed acceptance1.5x. Command: soldr cargo bench -p obs-c-oracle --bench port_comparison -- signal/emit(_global)?/4 --sample-size50 --measurement-time2 --warm-up-time1. Evidence: /home/niteris/.soldr/logs/porcelain/20261105T062220Z-home-niteris-dev-obs-rust-obs-studio.log. Performance RED is measurement, following #3410/#3427; behavior remains covered by existing callback suite.
Hold the outer mutex guard through each pass and use an owner token for same-thread recursive acquisition. Skip terminal empty snapshots when callbacks did not change the generation. Preserve callback exclusion, nested remove-current behavior, and waiter notification through the standard mutex.
82aa4bb to
0e479bf
Compare
|
Pushed lint repair Performance acceptance remains incomplete. New Criterion run (50 samples, 5s measurement, 2s warmup) measured emit/4 means Rust 160.141 ns vs C 120.665 ns (1.327x), and emit_global/4 Rust 171.677 ns vs C 95.286 ns (1.802x). The global path still exceeds 1.5x; this PR remains draft and #3350 remains open. Prior baseline and noisy repeats are documented above. Local evidence: soldr logs 20261105T064003Z (benchmark), 20261105T064025Z (callback tests), 20261105T064113Z (Clippy). |
Fixes #3350.
Signal emission with connected callbacks exceeded the 1.5× C performance target. The outer reentrant guard now holds its standard mutex across callbacks; recursive entry uses its thread owner token. Atomic list-emptiness flags remove the preliminary callback-list lock. Pass depth remains protected by the reentrant lock, and an unchanged outer-pass generation skips the final callback-list lock and sweep. Mutating callbacks still refresh snapshots and sweep marked entries at the outermost return, preserving callback order, recursive connect/disconnect, and disconnect exclusion.
RED:
e816030ccrecords the performance failure on master75a8dd7f1. GREEN:0502c2a3b,0e479bf0a, and795f9ce71.signal/emit/4signal/emit_global/4Final measurement:
SOLDR_RUSTC_WRAPPER=none soldr cargo bench -p obs-c-oracle --bench port_comparison -- 'signal/(emit/4|emit_global/4)' --sample-size 100 --measurement-time 5 --warm-up-time 2, run sequentially after local tests/lint stopped. Both mean ratios meet 1.5×. The global result is close to the limit; these are one host run, not a guarantee across machines. Final mean 95% confidence intervals: emit Rust 95.70–97.61 ns / C 86.37–88.43 ns; global Rust 144.52–147.91 ns / C 97.52–101.80 ns. Before/after host load differs, so ratios to each run's C control are the acceptance comparison.Validation:
soldr cargo test -p obs-data --test obs-tests-core callback::: 90 passed, 0 failed, 0.15 s on final implementation, including exact C-oracle parity, nested mutations, chunk boundaries, self-removal and concurrent disconnect/waiter cases.-D warnings, workspace rustfmt check, all 11 structural performance guards, and all 15 guard tests pass../lintis incomplete: stopped only this run's process tree after several minutes in unrelatedci/test_platform_missing_prototypes.pyon a heavily loaded shared host. Required PR Fast Gate remains the full lint gate. No local attestation claimed.Test cost: no new tests, test executables or threads.
Local evidence: soldr logs
20261105T065217Z(final callback tests),20261105T065014Z(Clippy),20261105T065317Z(fmt), and20261105T065828Z(final benchmark). Interrupted full-lint capture:local-test-OkvwZZ.log.Cleanup landing decision
The maintainer authorized resolving prior draft holds. Earlier comments describe intermediate measurements; the final body measurements at
795f9ce71b8727976808cc7ea00cb91f0efa2b66meet both issue bounds (1.106× and 1.467×). The global result remains close to the limit and host-dependent as disclosed above. Final required PR Fast Gate and all selected unchanged C Tier 2 ON/OFF and serial jobs passed. Reviewed the complete diff; no competing open signal-acceptance PR or later conflicting claim was found. No new test or weakened acceptance bound is introduced by this cleanup. The branch is conflict-free with master; repository coordination policy §4 delegates unrelated base updates to the merge queue. Queue admission will be pinned to the validated head.