Compile time problem

I have a project with two plugins and 34 files in total. Only two classes are big enough. Code is accurate, no unnecessary includes in headers, no monolithic headers used. I have enough memory (32 GB) and enough free space on all drives.

But any recompiling takes ~23 minutes, even if I changed just one line. Generally, it stucks at “Creating library” for most of this time with not very intensive usage of CPU by Microsoft C-C++ Compiler.

I already tried to remove Intermediate folder (so as Binaries). Don’t know what else can I try. Any ideas?

Do you use ue4 form source? (see image)
or
Go back to the Unreal Editor and click the Compile button in the toolbar at the top of the screen. (Programming Quick Start | Unreal Engine Documentation)

No, it’s launcher version 4.24.2. But the issue persists when compiling for 4.23 as well.

More info. I have three modules in my plugin, building of .lib stucks at different module every time with CPU working at ~12% (i. e. it’s 1 logical core of 8).

Open a task management
Recompile
See disk read rate

No, it doesn’t use disk. Only CPU.

How do you build?

see VS Editor:

like this file ‘[2/3] UE4Editor-ttttttplay-0002.dll’, only it recompile.

check path (the compiled file is here): [you project name] \Binaries\Win64
delete all *.dll and *.pdb

I tried different ways.
a. in Visual Studio (config doesn’t matter, but usually DevelopmentEditor/Win64).
b. building plugin only via command line


RunUAT.bat BuildPlugin -Plugin="G:\MyDocuments\Unreal Projects\ViveMocap\Plugins\ViveMocapKit\ViveMocapKit.uplugin" -Package="G:\MyDocuments\Unreal Projects\Plugins\ViveMocapKit" -Rocket

And that’s what I get:

As I said, i tried to remove both Binaries and Intermediate folders in the project’s and in the plugin’s folders. Also, when compiling a plugin via command line, it creates blank HostProject and builds everything from scratch.

The last attempt:
In UE4 Editor menu
File -> Package Project -> Supported Platforms
Turn off unused options

Use ‘Compile’ button (icon is Rubik’s cube)

If the problem still persists, maybe the problem is a plug-in.
remember C++ boost? maybe an hour longer.

I use white list already.

It’s in the plugin for sure, but if I separated all plugin’s modules in defferent plugins, they would compile quickly.

Upd. Not exactly. I traced the problem to the module which includes one large class (6000 lines in cpp). Though, there are larger classes in the engine.

You have to make sure all your plugin modules have a properly configured PCH settings.
If you don’t configure PCH option in your Build.cs files each compilation could take several minutes…

PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
And I follow all IWYU rules.

Tried to compile at my laptop with a bit more powerful CPU but without SSD. The same result.

PrivatePCHHeaderFile = “xxx.h” should also be set.
I usually use the header which I include mostly engine headers.

Then VS only compiles my plugin’s changed sources without walking the whole engine tree and compilation is around 4~6 seconds.

Yes. And I have this problem even if I remove all other modules but one from the plugin.

Hmm… You should seriously review your setup because after first build of the day I always get this for plugins compilations:

It’s always around that build time for me…

It’s just perfect. Nothing to improve here. My only assupmtion is that file is too big.

What files do you include inside of your PCH file ?
Are you making changes to sources you include in the pch?

Removed all inline specifiers. Compiling time below one minute. Hmmmmm.