Download

Faster compile times?

Looking for ways to improve C++ compile times.

Right now even with my smallish project, compiles are taking 30-60 seconds just touching one .cpp file.

I had done some research and found these in .build.cs…


PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
PrivatePCHHeaderFile = "MaulProtoPrecompiled.h";
MinFilesUsingPrecompiledHeaderOverride = 1;
bUseUnity = false;


edit - fixed/fixing compile errors, will report if I get any speed up

Is this on a SSD drive?
I had similar issues (compiling time) before moving UE4 Install and Project on a SSD.

Yes, it’s on a SSD drive.

Success! My build time for one .cpp file has gone from 60 seconds to 8 seconds using some additional options in my .build.cs file…


PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
PrivatePCHHeaderFile = "MaulProtoPrecompiled.h";
MinFilesUsingPrecompiledHeaderOverride = 1;
bUseUnity = false;

Precompiled header helps speed things up too, based on some quick testing it looks best to have all the main Unreal headers there, and headers used commonly but not touched very often.



// MaulProtoPrecompiled.h

#pragma once

#include "CoreMinimal.h"
#include "Engine.h"

Also, when I hit compile it actually shows me what .cpp files it’s compiling in Visual Studio which is nice to see progress.

edit - This is such a huge productivity booster. Development is now much more fun. Definitely recommend for smaller projects.

1 Like