x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Long compile times for C++ projects

Please read the update bellow!


Hello dear reader, before you discard this post as being a duplicate please read the whole thing. I spent 2 days of reading tips and steps to speed up compiling time, however no progress was made.

Something is causing long compile times for my Unreal projects. I have no specific reason I can point at, but here is what I observed. In July 2018 I was using installed version 4.19.2 for the Battle Tank project (one of GameDev.tv Udemy courses). Compile times were decent - about 30 sec on average. I was quite happy with that.

Fast forward, about a week ago I started working on a project for my dissertation and since I didn't have the installed version of Unreal any more and I don't have a broadband connection at the moment, I decided I'll just compile the engine from the source code and hit it from there - latest pull of the release branch (4.21.1). Everything went smoothly, however compiling the engine took more than it used to few months back - now it took about 4 hours. I thought, yeah, it's the engine, it will take a while. So I carried on with setting up the project (C++, no template, no starter content, max quality). Than I started noticing that most of the compilation times take well over 30 sec. It varies, but it's usually around 250-360 seconds. And the it does not matter if I change only one .cpp file, only one .h or multiple files. Now I'm getting slightly worried about the whole thing since it took me 3 days to develop something basic that would be usually done in max 1 day. Even adding a new C++ class from inside the editor takes over 200 sec.

The machine I'm working on hasn't change since July 2018:

  • CPU: AMD FX 6300 - 6 core

  • RAM: 8GB DDR3

  • GPU: Radeon R9 380, 4GB GDDR5

Only thing that changed is that I updated Visual Studio to 15.9.4 (don't remember what version it was in July) and that I'm using a source code of a newer version of Unreal Engine instead of the one downloaded and installed through the Epic Games Launcher.

If anyone has any advice I'm all ears and would appreciate it very much :) I would install the pre-compiled version to test the difference, but as I said, no broadband available until further notice and I'm using a desktop machine. Working on finding an alternate solution to get it installed. Heck, I'd gladly re-install Windows and VS 2017 if I get a chance.

Note: I'm not an expert with C++ toolkit setup, but I can dig into the Unreal Build Tool with some guidance if required. I already changed the BuildConfiguration.xml to following:

 <?xml version="1.0" encoding="utf-8" ?>
 <Configuration xmlns="https://www.unrealengine.com/BuildConfiguration">
     <BuildConfiguration>
         <bUseUnityBuild>false</bUseUnityBuild>
         <MinFilesUsingPrecompiledHeader>1</MinFilesUsingPrecompiledHeader>
     </BuildConfiguration>
     <SourceFileWorkingSet>
         <Provider>None</Provider>
         <RepositoryPath></RepositoryPath>
         <GitPath></GitPath>
     </SourceFileWorkingSet>
 </Configuration>
 

This is being picked up by the Build Tool since I get no more git updates when starting the compilation process.


UPDATE (might prove useful to someone):

I changed my CPU to i7 4790k and a motherboard to go with it. The rest of the hardware stayed the same. At this point I didn't have means of re-installing Windows 10, so I worked with new CPU and MBO on the OS that previously ran an AMD setup - foolish I know, but I had to do something. System was very stable and I did notice instant speed boost in Windows nevertheless. However, the compile times were still way to long. Better, but not good (~200 seconds).

So with the first chance possible I nuked the operating system on my machine. A clean install of Windows 10 followed. I also installed the latest version of Visual Studio 2017 Community (15.9.7) using the offline installer. Regarding Unreal Engine, I installed the pre-built version of 4.21.2, but only the core and the engine source were checked in the install options. I did this just to have a fallback in case source version of the engine doesn't work out and also I had a weird unjustified feeling that the installed version (the one from the launcher) could create some settings like the BuildConfiguration.xml which wouldn't be made when building the engine from the source. The one thing I noticed was that the BuildConfiguration.xml was created in my C:\Users\UserName\AppData\Roaming\Unreal Engine\UnrealBuildTool, but with none of the settings applied, just the empty configuration.

 <?xml version="1.0" encoding="utf-8" ?>
 <Configuration xmlns="https://www.unrealengine.com/BuildConfiguration">
 </Configuration>

Finally I built the engine from source, again the 4.21.2 version, from the release branch. Guess what, it compiled in 54 minutes! This was very fast for my expectations. Even when everything was working reasonably the engine would compile in approx 2 hours and with stuff not working well lately the engine build took over 7 hours. With that said, I continued working on my project and from what I can see so far compilation times are very good averaging at around 20 seconds. Finally, some enjoyable work process can follow.

As for what caused long compilation times, I am not sure. It most certainly isn't the CPU, at least not to the extent of being 10 times slower. The issue was either in the OS (something I did or something another program did) or in the fact that installing an engine version using the Epic Launcher actually made something I'm not aware of.

If anyone can come up with a good explanation I'll be happy to accept it as an answer to this issue for future readers.

Product Version: UE 4.21
Tags:
more ▼

asked Jan 21 '19 at 02:18 PM in C++ Programming

avatar image

CiborgCG
11 4 4

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

I don't know if this helps you but i had the exact same, really slow compile times using 4.21.2 but for shit's and giggles i forgot i set UE to use VS2017 to see if "Loading VS screen" had been fixed ( which still seems not recognizing VS is already runnnig?) so i switched just "Visual Studio" which for me solved the issue. Also maybe check if VS has been setup to use all available cores so it hasn't reset this for some reason.

Good luck

more ▼

answered Feb 08 '19 at 12:55 PM

avatar image

SirTainly
1 1 2

avatar image CiborgCG Feb 08 '19 at 01:14 PM

Thanks for answering SirTainly. Sadly, Visual Studio is already selected in UE as a source code editor. Also, Unreal Build Tool logs say that its compiling using 6 processes and I checked the resources to see if all cores are utilised, which they are. Either this issue is due to my machine or some setting somewhere I am not aware of. I'm still trying to find a way to install pre-built UE4 to see if the same issue exists.

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question