[Investigating] Excessive CPU usage on macOS

I noticed that PQ3 has very high CPU usage, even when just idling at a menu screen. It’s the only program that causes my M4 Macbook Air to become quite hot when running. Activity Monitor reports the process taking around 300% CPU usage.

I also noticed when running the game on my Xbox One X it seems to stress the system more than much more graphically intense games, causing the fan to become quite loud.

I took the liberty of profiling the game with Instruments and the culprit seems to be the Timer-Scheduler thread. It looks like this is a thread that dispatches timed events, but instead of sleeping until the next event arrives it appears to be a busy loop that constantly queries the current time - 43.3% of the CPU time in this thread is spent just calling mach_absolute_time() which is the macOS function to get the monotonic clock time.

I think the developers should take a look in to the implementation and consider using sleeps to wait for the next event instead of busy looping which burns my lap and kills my battery life!

4 Likes

A simple, quick fix might be to just put a small (e.g. 10ms) sleep in the loop, which would slightly reduce the accuracy of timers but greatly reduce CPU usage.

2 Likes

I really admire that you have tracked this down. I hope the dev team will look into this. CPU usage and battery life have plagued this game from the very beginning.
@Jeto, can you please pass this on?

3 Likes

I gave up playing PQ3 on the PS4/PS4 Pro as the fans are louder than the runway at Gatwick.

*slight exaggeration.

2 Likes

I really hope the devs can fix this. There’s no reason this game should be a CPU hog. It’s not doing realtime physics or simulating a massive open world environment - the core game logic could run on an 8088. Most of the CPU time should be sending rendering commands to the GPU and handling the network stuff. The main thread is only using about 25% of a CPU core and all the other threads are mostly idle.

1 Like

Even after going into the settings - display and changing the graphic settings? From quality to performance and the target fps from 60 to 30 fps.

1 Like

Yep. Even after adjusting all settings. I’ve got 3 PS4 Pros and 2 OG PS4s and the fans ramp up drastically on all of them when playing PQ3. (I’m also extremely fastidious about keeping my kit clean and dust-free)

On my PS5 and PS5 Pro the game runs fine and the consoles remain silent.

3 Likes

Wow so many, I’m jealous. I only have the one ps4 slim and its pretty old.

2 Likes

Anyone playing on console, are you using Performance mode or Quality mode? Since Performance mode should be less intensive on the system.

As for your report @shaurz, do you know if you are playing an iOS version of PQ3 or the PC version, from Steam?
Just because if it’s a weird Apple App port to Mac, because we don’t officially support Mac, then that could have it’s whole own range of issues because it’s unsupported

The mach_absolute_time is actually not something we have control over, and would be a weird Unity issue/interaction etc.

But either way, I am following up what I can.

1 Like

Play on the PS4 and use 30fps and performance mode and it does help alot.

One huge positive of the way the game is right now is when it does crash, you almost always go back to the moment you were at just prior to the crash or loss of internet or whatever, when you get back on afterwards. So losing out on something can happen, but its pretty rare.

2 Likes

I believe it’s the iPad version. I installed it from the App Store.

2 Likes

Considering the amount of time you invest in PQ3 you really owe yourself an upgrade Kenpo. The PS5 version is far more pleasurable to play purely because of the greatly reduced load times (and lack of fan noise).

I really hate the term now that it’s so often used, but it is a game changer.

3 Likes

I looked in to this further with regards to what APIs are provided by Unity, and mach_absolute_time is probably being called whenever the game accesses Time.realtimeSinceStartup or Time.unscaledTime. I wondered if Unity provided a built-in component for scheduling timers, but it appears this is not the case, so this loop is likely in the game code.

1 Like

I also run on playstation 5 and have 2 consoles, 1 original and the other a newer slim model.

I can run performance / 60 fps very happily on the slim but have to drop this to 30 FPS on the original (old) model.

Boss rush really stretches :flexed_biceps::grin: both consoles however I’m not as malicious as Swivel when it comes to dusting :face_with_peeking_eye:

2 Likes

My skin is itching just thinking about that dust.

I do hope you wipe your muddy paws before touching that controller!

4 Likes

I actually run my house AC at cooler temp when playing pq3. The ambient temperature appears to have an effect on the PS5 ability to remain cool. I do hear the fan from time to time, it is obnoxious lol. Not with The Show or COD do I have to hear the console fan so often and strong.

I don’t like the idea of diminishing the quality of my gameplay visually, if it is a bandaid for bad game code as is suggested previously. I have done it too. PQ3 is the only game I have played and got an excessive temperature warning. Yes I play a lot, but not more or less than other games when I am into them.

Anyways, I am hopeful the team can come up with a solution in time. They have been pretty good about implementing fixes so far.

1 Like

As mentioned for Mac users specifically, as Puzzle Quest 3 is not currently supported for Mac devices, especially when downloading the app version, there are likely issues that will stem from this that we won’t be able to address.

The team is looking further into performance testing.