Skip to content

Decrease render event processing latency [msema] - #1007

Open
sbooth wants to merge 74 commits into
mainfrom
msema
Open

sbooth wants to merge 74 commits into
mainfrom
msema

Conversation

@sbooth

@sbooth sbooth commented Sep 16, 2026

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Changing synchronization from an audio render callback has real-time scheduling implications requiring human validation.

Pull request overview

Experiments with Mach semaphore-based event signaling for AudioPlayer.

Changes:

  • Adds a Mach semaphore wrapper.
  • Signals render events directly.
  • Replaces adaptive polling with a 500 ms timed wait.
File summaries
File Description
AudioPlayer.mm Updates render-event signaling and waiting.
AudioPlayer.h Adds the Mach semaphore implementation and member.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@sbooth sbooth changed the title Experimental mach semaphore_t usage Experimental mach semaphore usage Sep 21, 2026
@sbooth
sbooth marked this pull request as ready for review November 5, 2026 02:05
github-actions[bot]

This comment was marked as outdated.

@sbooth

sbooth commented Nov 5, 2026 •

Copy link
Copy Markdown
Owner Author

Time in render():

  Average Min Std dev Max
main 4.08–4.43 µs (≈4.3) ≈1.06 µs ≈3.3 µs 33–49 µs
dsema 12.01–12.36 µs (≈12.2) ≈3.6 µs ≈4.8 µs 40–50 µs
msema 11.15–11.69 µs (≈11.3) ≈3.2 µs ≈4.6 µs 40–60 µs

Frames rendered event delivery time:

  Average Min Max Std dev
main 4.60–4.71 ms 2.8–34 µs 9.41–9.46 ms ≈2.6 ms
dsema 57.8–59.6 µs 7–10 µs 114–121 µs ≈19 µs
msema 59.7–62.1 µs 9–10 µs 129–150 µs ≈18 µs

@sbooth
sbooth marked this pull request as draft November 5, 2026 14:15
@sbooth sbooth changed the title Decrease render event processing latency Decrease render event processing latency [msema] Nov 5, 2026
@sbooth
sbooth marked this pull request as ready for review November 9, 2026 22:05
@sbooth
sbooth requested a balanced review from Copilot November 9, 2026 22:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Mach semaphore signaling now runs in the real-time render callback, so deadline impact and concurrent wakeup behavior require macOS/iOS stress validation unavailable in this source-only review.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

This branch has not been deployed

No deployments
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.

2 participants