Slow build time with UE 4.15

Since I transitionned our project to UE 4.15 I experience very long time to build the project, even when I just update the CPP file.

With the in 4.14.3 in took less than 16 seconds…

Now in 4.15, the same build takes around 55 seconds.

What I changed in the code base was to remove the include to engine.h in our main header file, and replaced that line by CoreMinimal.h. I also added a few includes in the game code where needed.

I tried to play with the flag bEnforceIWYU in the build.cs file, but either true and false make the build last much longer…

I also have this error in the log of visual studio 2015 when I build:

This does not prevent the editor from successfully hot-reloading the code, but when I attach VS to the editor I can’t step in the code like I could do in UE 4.14.

Are there any more steps to take advantage of the IWYU feature?

Thanks!

Hello Zoubi,

There was an issue related to IWYU causing problems for plugins recently as it’s not on by default for Game configurations. I’m not sure if you’re having the same issue with your project but try adding this to your .build.cs:

PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs

Hello Matthew,

thanks for your comment. It did indeed fixed the slow build issue. We now have around 20% faster build times, as expected.

Nonetheless we have an error when we build the game while the editor is running. Here is the log:

1>------ Build started: Project: MyGame, Configuration: Development_Editor x64 ------
1>  Compiling game modules for hot reload
1>  Performing 3 actions (4 in parallel)
1>  Module.MyGame.cpp
1>  [2/3] Link UE4Editor-MyGame-6199.dll
1>  [3/3] Link UE4Editor-MyGame-971.lib
1>     Creating library C:\Projects\MyGame\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-MyGame-6199.lib and object C:\Projects\MyGame\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-MyGame-6199.exp
1>     Creating library C:\Projects\MyGame\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-MyGame-6199.suppressed.lib and object C:\Projects\MyGame\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-MyGame-6199.suppressed.exp
1>ERROR : UBT error : Failed to produce item: C:\Projects\MyGame\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-MyGame-971.lib
1>  Total build time: 14.81 seconds (Local executor: 0.00 seconds)
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.MakeFile.Targets(37,5): error MSB3075: The command ""C:\Program Files\Epic Games\4.15\Engine\Build\BatchFiles\Build.bat" MyGameEditor Win64 Development "C:\Projects\MyGame\MyGame.uproject" -waitmutex" exited with code 5. Please verify that you have sufficient rights to run this command.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Note that it does not prevent the editor from successfully loading the new DLL, and apparently it does not prevent me to put breakpoints and step in the code when I attach the debugger to the editor.

If the compiling is actually successfully completing and it’s just that Visual Studio is throwing errors, it should be a symptom of this bug: UE-42205.

yes it’s the behaviour I have right now

Hi,

I have PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs set, but it’s still about twice slower than before enabling IWYU. Using 4.15.3.

I fixed it by:

This isnt working im getting insanely high compile times, 22-25 seconds for changing a float variable.
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
bFasterWithoutUnity = true;

I already run on 2x SSD’s fx8300 4.2ghz, 12gb ram, editor installed on 1 SSD and project on other SSD still im not I/O bottlenecked its the build process that is slow.

Ok it got better after doing this:
"If you need to access UEngine or GEngine, which are defined in Runtime\Engine\Classes\Engine\Engine.h, you can #include Engine/Engine.h (distinguishing from the monolithic header file, which is located at Runtime\Engine\Public\Engine.h). "

Now i get 11.8 seconds build on chaning variables etc, still slow but workable.