Conversation
Acquire the channel mutex once per channel and copy the gain/pan values of all connected channels (compacted into the caller's channel order, with bounds guard) instead of acquiring it twice per channel pair (O(N^2) lock/unlock operations per server frame). The values are written directly into vecvecfGains/vecvecfPannings, no intermediate snapshot buffers are needed. Drop the now unused CChannel::GetGain()/GetPan(). Co-authored-by: mcfnord <mcfnord@users.noreply.github.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: QUIET Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthrough
ChangesChannel gain and panning retrieval
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Refactor Suggested reviewers: Merge Risk: ⚪ Minimal · up to No actionable merge-blocking risk is identified in this change. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| } | ||
| } | ||
|
|
||
| float CChannel::GetGain ( const int iChanID ) |
|
Related: #3945 |
Currently, we aquire a lock in GetPan, GetGain overly often in channel.cpp. We can use a one time snapshot and lock/unlock only once. Snapshotting removes constantly aquiring and releasing the Mutex which should give performance gains. Measurements suggest that it indeed gives a minor performance gain. I believe that this is safe (maybe even safer than the current code) from a concurrency viewpoint.
See AI findings/PR and more details here: ann0see#293
Short description of changes
CHANGELOG: Channel: Improve performance of getting gain and pan by using one time snapshot
Context: Fixes an issue?
Related to: #3916
Does this change need documentation? What needs to be documented and how?
No
Status of this Pull Request
Tested and measured by me and @mcfnord Needs review.
What is missing until this pull request can be merged?
Review
Checklist
AUTOBUILD: Please build all targets