Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

RazorBackXX

macrumors member
Original poster
Oct 1, 2023
62
8
Lylat System
"I'm trying to optimize game performance on my Mac and I'm curious about combining two different performance-boosting methods:

1. macOS Game Mode: I know this built-in feature prioritizes game performance when running full-screen. I think it allocates more system resources to the game, reduces background processes, and maybe adjusts power management.

2. A custom script I use with 'renice -20': This Unix command gives my game the highest possible priority, making the OS allocate more CPU time to it.

What I'm wondering is:

1. If I use both Game Mode and my 'renice -20' script, will I get extra benefits, or might they clash?

2. How might my 'renice -20' script affect the way Game Mode is using my CPU?

3. Has anyone tried using both at the same time? What happened when you did?

4. Are there any risks or downsides I should watch out for if I combine these?

I'm really trying to squeeze the best performance out of my Mac for gaming, but I don't want to mess things up by having these methods fight each other. If you've got any experience with this or insights to share, I'd really appreciate it!"
 

casperes1996

macrumors 604
Jan 26, 2014
7,599
5,771
Horsens, Denmark
Renicing a process is a pretty crude mechanism and doesn't have *that* much control over the complexities of macOS' scheduler. There are a lot of knobs it cannot touch. Furthermore, renicing the process may be detrimental to actual gaming performance. Game Mode is likely to have a more wholistic perspective on what the game needs to render its frames. The game process itself may need compute power, but it may also be more beneficial at times to allocate more CPU time to process that are not directly in the process space of the game; Like the MTL Compiler process or even boost the priority of kernel level GPU task submission. In these cases a dedicated Game Mode can help, where renicing the process may actually provide worse performance, especially in 1% and 0.1% lows. Note that the game developer is also responsible for putting relevant tasks on the correct DispatchQueues for optimising scheduling.
Besides, you're more likely to be GPU bottlenecked than CPU bottlenecked, and renice only affects CPU, and game mode primarily affects CPU. Impact isn't necessarily going to be that great anyway.

But YMMV and it can change on a game by game, OS-by-OS and Mac by Mac basis, so all you can really do is benchmark
 

RazorBackXX

macrumors member
Original poster
Oct 1, 2023
62
8
Lylat System
Renicing a process is a pretty crude mechanism and doesn't have *that* much control over the complexities of macOS' scheduler. There are a lot of knobs it cannot touch. Furthermore, renicing the process may be detrimental to actual gaming performance. Game Mode is likely to have a more wholistic perspective on what the game needs to render its frames. The game process itself may need compute power, but it may also be more beneficial at times to allocate more CPU time to process that are not directly in the process space of the game; Like the MTL Compiler process or even boost the priority of kernel level GPU task submission. In these cases a dedicated Game Mode can help, where renicing the process may actually provide worse performance, especially in 1% and 0.1% lows. Note that the game developer is also responsible for putting relevant tasks on the correct DispatchQueues for optimising scheduling.
Besides, you're more likely to be GPU bottlenecked than CPU bottlenecked, and renice only affects CPU, and game mode primarily affects CPU. Impact isn't necessarily going to be that great anyway.

But YMMV and it can change on a game by game, OS-by-OS and Mac by Mac basis, so all you can really do is benchmark
"Wow, thank you so much! It’s great to see someone who really knows what they’re talking about. I’m sorry I wasn’t clear before. I’m not referring to video games, like ones from Apple Arcade or Steam. I’m talking about emulators, like Ryujinx for the Switch and Dolphin for the GameCube. So, I should’ve explained better. Unless what you said still applies?

I know CPU is really important for emulators, but you’re right that the GPU can still be a bottleneck. Now that you know it’s emulators I’m trying to boost, does your advice still apply, or would it be different?

Also, just out of curiosity, what does YMMV mean? And how do you know Game Mode mainly affects the CPU? I’m asking because Apple doesn’t provide much documentation, and you seem to know a lot about CPUs. Lastly, do you think using renice -20 and Game Mode together would cause conflicts? I saw one forum saying it does, and another saying they’d work fine together. What’s your take?"
 
Last edited:

casperes1996

macrumors 604
Jan 26, 2014
7,599
5,771
Horsens, Denmark
"Wow, thank you so much! It’s great to see someone who really knows what they’re talking about. I’m sorry I wasn’t clear before. I’m not referring to video games, like ones from Apple Arcade or Steam. I’m talking about emulators, like Ryujinx for the Switch and Dolphin for the GameCube. So, I should’ve explained better. Unless what you said still applies?

I know CPU is really important for emulators, but you’re right that the GPU can still be a bottleneck. Now that you know it’s emulators I’m trying to boost, does your advice still apply, or would it be different?

Also, just out of curiosity, what does YMMV mean? And how do you know Game Mode mainly affects the CPU? I’m asking because Apple doesn’t provide much documentation, and you seem to know a lot about CPUs. Lastly, do you think using renice -20 and Game Mode together would cause conflicts? I saw one forum saying it does, and another saying they’d work fine together. What’s your take?"
You're welcome. Emulators are indeed a lot heavier on CPU than native games.

It should still apply however that it may be other processes than just the emulator process involved in running the game. In the case of emulators, there's a higher likelihood that you are bound by the emulator process as it is doing all of the translation work, but shader compilation (after the emulator process has generated MTL code) may still occur on a system process that you may then starve by renicing the process.

YMMV means "Your mileage may vary. A saying meaning that your results can depend on a lot of factors.

As for game mode, I've dug through a lot of resources from Apple and elsewhere when the feature was introduced. It's hard to dig up and I can't remember exactly where each resource said what - a lot of WWDC talks about Metal or other graphics related topics talked about Game Mode as an offhanded side note but still commented on it. - In addition, the scheduler is an obvious place to work with a feature like this and is also what Microsoft's Game Mode in Windows (powered by the Xbox Game Bar) and similar features in Linux do. Scheduler work will almost always primarily benefit the CPU because a lot of tasks are always scheduled on the CPU and very little work is scheduled for the GPU that isn't managed by a singular process in the first place. At least in the context of games. GPGPU can have threading and scheduling issues but in the context of playing a game without running scientific compute in the background the task of scheduling GPU tasks is in the hands of the game developer more so than the operating system. I have also just experimented with Game Mode and Metal system traces and the MTL Perf HUD and on my test systems at least only really see benefits in CPU congested situations. - I said "mainly" affects the CPU primarily because there's still some uncertainty surrounding game mode. Otherwise, based on experience, I would've said "only".

I don't necessarily think that a nice value of -20 per se would conflict with game mode. In that both will just supply hints to the scheduler. But I do think there's a chance it could, in some situations, hurt performance instead of improving it. In others it could improve, but in most, I think the difference is going to be so minuscule as to be margin of error, honestly.

My advice; Experiment
 

f54da

macrumors 6502a
Dec 22, 2021
504
186
In addition to above, on osx generally prefer manipulating thread QoS instead of using renice/thread-priority. You can read more at https://developer.apple.com/library...al/EnergyGuide-iOS/PrioritizeWorkWithQoS.html but generally ever since 10.10 apple has gone all in on QoS and pthread priority is effectively "legacy." A lot of the XNU scheduler has been rewritten to be QoS aware when allocating cpu or io resources.

Of course since QoS and thread priority are sort of orthogonal there's a natural question of how these interact. It's unfortunately a bit hard to get good info (and the details likely change each time the scheduler gets refactored), but I think Levin's books had a chart somewhere of the rough mapping.

There is also a handy cli command which dumps the state used by the scheduler for all threads of a process, which is invaluable for inspecting how the QoS your app changes based on state (e.g. backgrounded, foregrounded, etc.). I can't remember what it was though, I will edit this post if I remember.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.