Dude, maybe someone just has a crappy system. On my pathetic Intel Pentium CPU G4400 3.30GHz × 2 with a GeForce GT 1030, the load is less than 3 percent.
Dude, none of that —
Intel® Core™ i5-9500T, so six cores, each 2.2GHz up to 3.7GHz in turbo mode. As I mentioned earlier, a behemoth like
Hollow Knight: Silksong uses less CPU time than your simple demo (see attachment).
The problem isn't the 'crappiness' of the game or raylib — it's how modern CPUs react to constant 100% load on a single core.
The CPU responds correctly to a constant load by increasing its clock frequency to nearly its maximum. The problem isn't the processor's behavior (which is the effect); the problem is the very existence of a constant load (which is the cause) — there shouldn't be any such load at all.
And I don't know who's to blame here that the CPU decides to turbo boost from just one attempt to do some work.
It's not the CPU's fault that the game is forcing it to execute a plethora of instructions and monopolize the time of a single core. The game is to blame, because it either generates frames recklessly or does not sleep the thread between successive frames. So the culprit is either the game code, which for some reason doesn't limit the frame rate to the monitor's refresh rate or a reasonable value (like 60 or 100 ups); or raylib, which can't freeze the game thread between frames, putting a massive strain on the CPU. Either way, it's a terrible design and a source of embarrassment.
The '80s are long gone; modern PCs aren't like Atari or NES, and it's time to finally realize that. Every application — especially games — should use only as much CPU time as it needs and return the rest to the system by putting the thread to sleep. If the monitor has a 60Hz refresh rate (like mine), the game should render no more than 60 frames and sleep through the remaining time between frames using dedicated mechanisms for that purpose (such as sleeps, waitable timers, or VSync).
Otherwise, it will massively waste the processor's time, which will pointlessly increase its clock speed, take CPU time away from other processes, overheat the CPU, and thus drain the battery much faster and waste electricity. And that's exactly what your game is doing — it's pointlessly wasting CPU time and electricity, so it's time to fix it instead of blaming my system.
I'm working on a game myself (Free Pascal + SDL3), and I know exactly what I'm talking about. But my game doesn't eat up as much CPU time as it can, but only as much as it needs — at 60fps, it uses 2–3% of CPU time without causing the clock speed to increase (which remains at 1.1–1.3 GHz). This is because the main loop has a fixed update rate (60ups), while the time between consecutive frames is either slept using VSync or using the
SDL_DelayPrecise function (which internally uses waitable timers on Windows).
I respect users, their PCs and wallets — I recommend you start doing the same.