Handmade Hero»Forums»Code
Karl Kirch
18 posts
CPU usage high on OSX, what about other platforms?
So I've got day 38 loaded up in my swift platform layer and I'm seeing about 70% cpu usage when running in debug mode and about 45% usage when running in release mode. Like 95% of that usage is coming directly from the platform independent layer code (most of it is coming from the bitmap drawing code).

Was just wondering what other people were seeing from other platforms?
In particular, windows, linux, and the objc mac port.
Neil Blakey-Milner
45 posts
CPU usage high on OSX, what about other platforms?
My Linux port using xcb has the following behaviour:

Debug build:
~40% CPU - xcb_handmade

Opt build (-Ofast only)
~33% CPU

Other processes:

22% CPU - Xorg
11% CPU - gala (the ElementOS Window Manager)

Of course, I may have faster or more cores. I'm also running this in VirtualBox (Linux on Windows).
Casey Muratori
801 posts / 1 project
Casey Muratori is a programmer at Molly Rocket on the game 1935 and is the host of the educational programming series Handmade Hero.
CPU usage high on OSX, what about other platforms?
I haven't looked at this at all but that doesn't sound high to me. The bitmap drawing code is very unoptimized and has to touch a large number of pixels. CPUs aren't GPUs, so you can expect that soon we will actually be using 100% of the CPU all the time, and it will almost all be in rendering, because even though we will obviously be making much more optimal bitmap drawing routines, we will be drawing a lot more stuff!

- Casey
Karl Kirch
18 posts
CPU usage high on OSX, what about other platforms?
Yeah, I wasn't super concerned about the usage, just wanted to see where things stood for people.
Mike Oldham
6 posts
CPU usage high on OSX, what about other platforms?
My OSX port in debug mode runs right around 53% CPU with day 39 code.
Livet Ersomen Strøm
163 posts
CPU usage high on OSX, what about other platforms?
The way I understand it all the code we see now, or much of it is for illustrative purposes only. So we maybe shouldn't care much.
Andre Bauland
12 posts
CPU usage high on OSX, what about other platforms?
For me it's around 16%-18%
8 cores for me

[quote=Kladdehelvete]The way I understand it all the code we see now, or much of it is for illustrative purposes only. So we maybe shouldn't care much.
He said that we'll do the optimizations a lot later
So thats right ^^
13 posts
CPU usage high on OSX, what about other platforms?
I get about the same as @thrahistan....16%-18%

But I'm running an implementation of Handmade Hero that's a little different to most. I haven't heard anyone else mention this platform port... I'm writing it as faithful to Casey's as I can running on "HTML5" as a platform in ECMAScript 5.