r/Xcode • u/PEATCH_Dev • Dec 14 '25
Any way to speed up builds with GPU?
I’ve been working on a pretty meaty app for a couple years now, and because it’s so big it takes upwards of 45 minutes to do a full from-scratch build (I’m sure I can optimize it better. I’m self taught, so I’ve only learned the things I need for what I’m doing). I have a base spec M2 Pro MBP, and when I build I notice my cpu is pegged at 100% but the GPU doesn’t do anything. Is there any way to offload some of or even all of the building process to the GPU to make my builds faster?
4
Upvotes
6
u/Slow-Bodybuilder-972 Dec 14 '25
45 minutes?! I’m curious, how many kloc? What language?
Swift compile times can be brutal, with certain constructs being worse, this could be a factor.
You need to modularise your code, so you don’t need to clean build all the time.
4
u/wipecraft Dec 14 '25
No, but 45 minutes is insane if it’s just a local clean debug build . 100% you can reduce that heavily by optimizing your setup and code. Is that a debug build? Release? Does it include unit and ui tests?
3
u/[deleted] Dec 14 '25
You have an m2 and it takes 45 minutes?! That’s actually insane
1
u/spinwizard69 Dec 14 '25
I see we have some spoiled people in the thread that thinks 45 minutes is a long time, apparently they have never compiles something like Linux on a old machine. Then there is C++ with programs that use ever advanced feature they can throw at the compiler, so 45 minutes might be excellent in this case.
Here are some questions that might help people in the future give you useful answers:
In any event please provide useful info for others to follow up on.
2
u/psychonaut_eyes Dec 14 '25
Daaaaaaaaamn! 45 minutes was what took me do build a whole simulation game from scratch, with included engine in unreal. over 200GB of assets and sources.
Something is very weird there.
1
u/smallduck Dec 14 '25
Very likely not.
1
u/SneakingCat Dec 14 '25
I think you would be better served by spending your time trying to reduce the build time. I wonder if you can still leverage a DTS incident into a phone call with an expert?
1
u/germansnowman Dec 15 '25
Apple has some guidelines for improving build times:
https://developer.apple.com/documentation/xcode/improving-build-efficiency-with-good-coding-practices
https://developer.apple.com/documentation/xcode/building-your-project-with-explicit-module-dependencies
https://developer.apple.com/documentation/xcode/improving-the-speed-of-incremental-builds
1
u/Responsible-Gear-400 Dec 17 '25
While it seems like we’d use a GPU’s massive parallel systems to compile many files at once there are a few things that don’t lend well to using GPUs for compiling.
If I was you I’d review your project structure and dependencies and attempt to optimise your project setup. Others have posted guides so I won’t repost them here for you.