mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-12 18:31:05 +00:00
plat_thread_id made a gettid syscall on every call, and plat_rmutex_lock calls it on every acquire: about 685,000 syscalls a second in the open world on 1.4.3. A thread's id never changes and the runtime starts child processes with posix_spawn only, so the id now comes from a __thread cache after the first call. Windows is unchanged: GetCurrentThreadId reads the TEB. Found, measured and fixed by H.A. Forster in issue #236 (RTX 2060 laptop: 36.3 to 46.0 fps with replay_async). SchulzCode confirmed it on an RTX 2070 Super with a 7800X3D: 98 to 120 fps at game resolution, 76 to 90 fps at render_scale 150. Co-Authored-By: H.A. Forster <154697759+h-a-forster@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>