Why do my project build times skyrocket after 4.1?

Dear Friends at Epic,

I compiled my 4.1 Editor from Github.

I generated project files for my uproject, after deleting my intermediate and .sln .

I got through all compile errors for my project.

#.cpp Only

When I make very minor changes in cpp only (just commenting or uncommenting 1 line)

The compile time that was

6 seconds

is now

240 seconds / 4 minutes

Heeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeelp!

#Build.cs

// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.

using UnrealBuildTool;

public class VictoryGame : ModuleRules
{
	public VictoryGame(TargetInfo Target)
	{
        //Private Paths
        PrivateIncludePaths.AddRange(new string[] { 
			"VictoryGame/Private",
			"VictoryGame/Private/Player",
            "VictoryGame/Private/VictoryCore"
            });

        //Public
        PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine",  
			"RHI", "RenderCore", "ShaderCore",
            "OnlineSubsystem", "OnlineSubsystemUtils"
        });

        //Private Module Dependencies
        PrivateDependencyModuleNames.AddRange(new string[] { "InputCore", "HTTP", "AnimGraph", "BlueprintGraph" });// , "UnrealEd"}); //, "Slate" });

        //Private Module Paths
        PrivateIncludePathModuleNames.AddRange(new string[] { "MeshUtilities" });
        
        //Dynamically Loaded Modules
        DynamicallyLoadedModuleNames.AddRange(new string[] { "MeshUtilities" });


        //~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        //Online Subsystem Module by Platform
        //~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        if ((Target.Platform == UnrealTargetPlatform.Win32) || (Target.Platform == UnrealTargetPlatform.Win64) || (Target.Platform == UnrealTargetPlatform.Mac))
        {
            if (UEBuildConfiguration.bCompileSteamOSS == true)
            {
                DynamicallyLoadedModuleNames.Add("OnlineSubsystemSteam");
            }
            DynamicallyLoadedModuleNames.Add("OnlineSubsystemNull");
        }
        else if (Target.Platform == UnrealTargetPlatform.PS4)
        {
            DynamicallyLoadedModuleNames.Add("OnlineSubsystemPS4");
        }
        else if (Target.Platform == UnrealTargetPlatform.XboxOne)
        {
            DynamicallyLoadedModuleNames.Add("OnlineSubsystemLive");
        }

	}
}

#Beta Solution Fixes Issue

Due to some of the UBT changes I think this missed the update

Re-implementing the Beta solution in my Build.cs fixed the problem!

I would like Epic to see this so I am not making this answer

// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.

using UnrealBuildTool;

public class VictoryGame : ModuleRules
{
	public VictoryGame(TargetInfo Target)
	{
        MinFilesUsingPrecompiledHeaderOverride = 1;
        bFasterWithoutUnity = true;

#PS

Do NOT use this solution if you are using the more recent convention of putting the .h of every .cpp at the top of the .cpp (the way new projects are laid out)

this is for projects with classes/private/public folder structure only

new projects will not compile if you do this

but it is essential for classes/private/public projects

Don’t put every .h file at the beginning of every .cpp file. Reference headers of only those classes that are used. Plus the problem with compilation could be somewhere in your code. I got rid of private/classes folders and have everything organized the way I like and it works with bFasterWithoutUnity = true.

This is definitely not expected. We’re looking into it. Sorry about the trouble.

The idea is that with smaller projects, non-unity compilation and PCH files are forced enabled so that you get the fastest possible iteration times. UBT has a setting that configures what is considered a “small project”. It is possible something has regressed with this feature. We’ll check it out and get it fixed if so.

–Mike

Thanks Mike!

Again it only happens with the classes/private/public structure.

The new format that comes with new projects works fine :slight_smile:

But my project is too huge to convert over to that more recent format :slight_smile:

(plus Shootergame and the Engine itself still use the older format :), and I much prefer it for larger projects )

Rama

Dear Mike,

Please check this out when you get a chance, it is driving me bonkers :slight_smile:

Very strange. We’re looking into it.