[GH-ISSUE #5192] macOS: the game freezes ~100 ms once a second (audio device listing on the render thread) #1587

Closed
opened 2026-11-02 15:48:11 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @vivescene on GitHub (Oct 31, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/5192

Originally assigned to: @vivescene on GitHub.

Filed by vivescene's AI agent (Claude Code, Claude Opus 5.5), not by vivescene personally.

Summary

On macOS, the game freezes for about 100 ms once a second, every second, while playing. The frame overlay shows ~4.5 ms frames with max stuck around 70–110 ms. It is the macOS side of #5098: Audio::should_change_device calls output_devices() every 20 ticks on the render thread, and on Core Audio that call is slow. #5102 gates it on Linux only and leaves macOS as it was.

Environment

  • Horizon nightly nightly-2026-10-31-9d979ca, macOS 26 on an Apple M4 (Mac mini), 144 Hz display
  • 19 Core Audio devices, 12 of them outputs (RØDE Unify, Elgato Wave Link, Background Music virtual devices plus the built-in ones)

Evidence

  • HORIZON_SPIKES=30: one slow frame a second, all with almost no time in any span and the render thread mostly idle:
    slow frame 107.9 ms, cpu 11.4 ms (1 ticks): tick 0.6, renderer 0.5
  • sample of the running client (6 s): Audio::tick → audio::output_devices → cpal supports_output → supported_configs → AudioComponentInstanceNew / AudioUnitSetProperty / AudioDeviceCreateIOProcID (mach_msg to coreaudiod), ~400 ms of the 6 s on the main thread.
  • cpal 0.16 timed directly on the same machine: host.output_devices() with names 89 ms (2.3 s on the first call), host.devices() with names 2.4 ms, default_output_device() 0.05 ms.
  • HORIZON_NO_AUDIO=1: zero slow frames.
Originally created by @vivescene on GitHub (Oct 31, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/5192 Originally assigned to: @vivescene on GitHub. Filed by vivescene's AI agent (Claude Code, Claude Opus 5.5), not by vivescene personally. ## Summary On macOS, the game freezes for about 100 ms once a second, every second, while playing. The frame overlay shows ~4.5 ms frames with `max` stuck around 70–110 ms. It is the macOS side of #5098: `Audio::should_change_device` calls `output_devices()` every 20 ticks on the render thread, and on Core Audio that call is slow. #5102 gates it on Linux only and leaves macOS as it was. ## Environment - Horizon nightly `nightly-2026-10-31-9d979ca`, macOS 26 on an Apple M4 (Mac mini), 144 Hz display - 19 Core Audio devices, 12 of them outputs (RØDE Unify, Elgato Wave Link, Background Music virtual devices plus the built-in ones) ## Evidence - `HORIZON_SPIKES=30`: one slow frame a second, all with almost no time in any span and the render thread mostly idle: `slow frame 107.9 ms, cpu 11.4 ms (1 ticks): tick 0.6, renderer 0.5` - `sample` of the running client (6 s): `Audio::tick` → `audio::output_devices` → cpal `supports_output` → `supported_configs` → `AudioComponentInstanceNew` / `AudioUnitSetProperty` / `AudioDeviceCreateIOProcID` (mach_msg to coreaudiod), ~400 ms of the 6 s on the main thread. - cpal 0.16 timed directly on the same machine: `host.output_devices()` with names 89 ms (2.3 s on the first call), `host.devices()` with names 2.4 ms, `default_output_device()` 0.05 ms. - `HORIZON_NO_AUDIO=1`: zero slow frames.
Author
Owner

@vivescene commented on GitHub (Oct 31, 2026):

🤖 Agent: /claim

<!-- gh-comment-id:6544939923 --> @vivescene commented on GitHub (Oct 31, 2026): 🤖 Agent: /claim
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#1587
No description provided.