[GH-ISSUE #495] [performance] Frame-time spikes at every game tick: ticking runs on the render thread #142

Closed
opened 2026-11-02 15:36:44 +07:00 by bsakaguchi · 3 comments
Owner

Originally created by @ludovic111 on GitHub (Oct 16, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/495

Reported on Discord by rdbt in #horizon-chat (2026-10-16): "game ticks are affecting render performance", "is there no multithreading".

Screenshot (F3, Ryzen 5 5600X, RTX 4060, Vulkan, 1920x1080, immediate present, 257 FPS): the frame-time chart has a regular spike train (frames 3 ms min / 4 ms avg / 15 ms max) whose spacing matches the 20 TPS tick rate. The TPS chart shows the integrated server at 10.7 ms per tick (9 min / 13 avg / 34 max).
https://cdn.discordapp.com/attachments/1559242412121919620/1560630714821640312/image.png

Vanilla runs the integrated server on its own thread, so a server tick never stalls a client frame; only the client tick (Minecraft.tick, cheap) runs between frames. Check where Horizon runs the integrated server tick, entity/world ticking and chunk work relative to the render loop.

Possibly the same root cause as #494 (8 FPS with 121 ms of CPU per frame on a slower machine) and #271.

Originally created by @ludovic111 on GitHub (Oct 16, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/495 Reported on Discord by rdbt in #horizon-chat (2026-10-16): "game ticks are affecting render performance", "is there no multithreading". Screenshot (F3, Ryzen 5 5600X, RTX 4060, Vulkan, 1920x1080, immediate present, 257 FPS): the frame-time chart has a regular spike train (frames 3 ms min / 4 ms avg / **15 ms max**) whose spacing matches the 20 TPS tick rate. The TPS chart shows the integrated server at 10.7 ms per tick (9 min / 13 avg / 34 max). https://cdn.discordapp.com/attachments/1559242412121919620/1560630714821640312/image.png Vanilla runs the integrated server on its own thread, so a server tick never stalls a client frame; only the client tick (`Minecraft.tick`, cheap) runs between frames. Check where Horizon runs the integrated server tick, entity/world ticking and chunk work relative to the render loop. Possibly the same root cause as #494 (8 FPS with 121 ms of CPU per frame on a slower machine) and #271.
bsakaguchi 2026-11-02 15:36:44 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@ludovic111 commented on GitHub (Oct 16, 2026):

More from rdbt (Discord):

<!-- gh-comment-id:6216594651 --> @ludovic111 commented on GitHub (Oct 16, 2026): More from rdbt (Discord): - **Pausing the game makes the stutters disappear.** That points at tick work rather than rendering. - Vanilla on the same machine is far smoother, even while its TPS is dying: https://cdn.discordapp.com/attachments/1559242412121919620/1560631220981858324/image.png
Author
Owner

@rdbtCVS commented on GitHub (Oct 17, 2026):

What is remaining to do on this? This should be made the default rather than opt-in as soon as possible.
If game ticks take longer than 50ms then the game becomes completely unplayable.

<!-- gh-comment-id:6234471555 --> @rdbtCVS commented on GitHub (Oct 17, 2026): What is remaining to do on this? This should be made the default rather than opt-in as soon as possible. If game ticks take longer than 50ms then the game becomes completely unplayable.
Author
Owner

@ludovic111 commented on GitHub (Oct 21, 2026):

🤖 Agent: closing as a duplicate of #1072, which tracks the fix for this: single player on its own server thread by default, like vanilla's integrated server. Thanks rdbt for the report and the measurements.

Where it stands: --server-thread (or HORIZON_SERVER_THREAD=1) already moves world ticking off the render thread. That's the opt-in from #544, and it is what removes these spikes; rdbt measured 300 → 600 FPS at RD 32 with it. Making it the default is blocked on the items listed in #1072: sending every entity type to server clients, exhaustion from moving, and /tick (#1038). I've carried your notes over to #1072: pausing removes the stutter, and ticks over 50 ms make the game unplayable.

<!-- gh-comment-id:6313524688 --> @ludovic111 commented on GitHub (Oct 21, 2026): 🤖 Agent: closing as a duplicate of #1072, which tracks the fix for this: single player on its own server thread by default, like vanilla's integrated server. Thanks rdbt for the report and the measurements. Where it stands: `--server-thread` (or `HORIZON_SERVER_THREAD=1`) already moves world ticking off the render thread. That's the opt-in from #544, and it is what removes these spikes; rdbt measured 300 → 600 FPS at RD 32 with it. Making it the default is blocked on the items listed in #1072: sending every entity type to server clients, exhaustion from moving, and `/tick` (#1038). I've carried your notes over to #1072: pausing removes the stutter, and ticks over 50 ms make the game unplayable.
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#142
No description provided.