Over 900 seconds of compilation time!

Compilation keeps taking too long when I change only the header file.

I have already tried the solution of changing the UnrealHeaderTool.target file and it continues to take a long time.

Too long !!!
more than 990 seconds !!! … more than 16 minutes !!!
It is not normal.
:-1:

The other suggested topics, where the same happens, do not give the answer.
There is one who says it is solved, but it is a lie. :-1:

My processor is an Intel Core i5-6300 2.50 GHz
And I have an 8GB Ram

Thank you.

There’s a lot of reasons why it might be.

But, the CPU is about 4x lower than my own system so cut 16 into 4 and its just 4 minutes on mine at that number.

On top of that the 6300 is only 2 core and UE4 editor recommends 4 core minimum. So you have that strike going against it.

You may also have the Intel CPU security patches factor going against it as well which heavily lowers the performance of the CPU. If they are enabled, they can be disabled if you wish to lower security and might speed compilation up a good amount.

You also don’t show what headers are being used if you are including too much or too heavy of headers in the code. Epic doesn’t use certain ones anymore by default because of the compile time so if you manually use it then compile time increase.

Disk speed, ram speed, cpu speed can also increase or decrease time.

Possible other issues.

Overall, its possible that the time is right for your hardware whether you decide it is or not but its not possible to say without a ton of info or direct access to your computer and a lot of testing or maybe a direct comparison of very similar hardware.

First of all, thank you very much for your answer.
And in principle of all, it may be, that the UE4 editor recommends the use of a minimum of 4 cores.

The point is that I would believe it if it were a graphical process issue but we are talking about only compilation and linking issue.

I’m with the BullCow Game lesson, and the only thing I’m modifying is the header of “BullCowCartridge.h”, only 1 file.

I have used my laptop in a generalized way with Visual Studio 2015, 2017 and 2019, and it has made the compilation of solutions with more than 50 projects without major problem, and the complete recompilation of these has never lasted me more than 5 minutes.

They have never lasted more than 16 minutes, due to the modification of a simple header. Only One Header File.

I dont believe it.

I have compiled hundreds of files and it has not been more than 5 minutes in total.
And here, I modify only one file and it takes me 16 (?)

There should be a reason, and those who have posted topics on this issue do not have it resolved.

and I still don’t believe it’s just a CPU problem.

Although, of course, for now I do not rule it out.

Thanks anyway.

1 Like

For reference here, this is what I get by adding a function to the header file in VS 2019 after importing the project into UE4.25 and after an initial build:

CompilerResultsLog: Total time in Parallel executor: 3.05 seconds
CompilerResultsLog: Total execution time: 14.43 seconds

Either you have some weird setting or computer issue or UE Editor has a difficult time on your hardware if its taking that long with the default project.

And again, I assume that you didn’t mess with the project in a way that causes it to take much longer - believe you don’t say how you modified it or changed settings or whatever. It might be good to burn it all down and uninstall everything, clean off all leftover files, then reinstall fresh and import the project fresh and see if it still does it.

If it still does after that then it makes sense that the editor has a problem with your hardware or your hardware isn’t good enough.

ok.
It’s true, I don’t have the right equipment.
But I insist, you are masking a mistake.
Modifying a single file cannot make the compilation take that long.
And your 4, 8, or 12 cores just hide it.
There is no efficient compilation.
And there has to be a reason.

Pls send the code image, would you like to?

It is not a code problem.
The code ends up compiling and runs fine.
The problem is how it is compiled.

Is it possible, or not, I don’t know, that the answer is in this message?
(I put it in the first post)

what is this?

And there have even been times that it has compiled with decent timing.

I’m using the UE 4.25.3

Thank you.

Believe the backwards compatible settings is just a message and isn’t the issue here. Epic had changed the compilation previously to not include as much when building https://docs.unrealengine.com/en-US/Programming/BuildTools/UnrealBuildTool/IWYU/index.html That message says it can be suppressed if seeing it is an issue for you.

And there have even been times that it has compiled with decent timing.

Since you’re unwilling to show code and don’t say exactly what you’re doing, maybe you’re running into this or some other issue:

You have to understand, its really difficult if you don’t show code or say all of what you’ve changed or done. Since it does have good speed at times then it should obviously be from what you’re doing.

II already said it in the second reply.

And as I said in the first message I was already testing the possible solution to modify:
UnrealHeaderTool.target

I was in section 3 of the UnReal course in C ++.
(Now, i’m in section 4)
And the code was the BullCowCartridge.cpp and .h
And it does not have more than some differences with what Michael tries to explain in the Secction 3 of the course …

But I have no problem.
Here it is.

“BullCowCartridge.h”

// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "Console/Cartridge.h"
#include "BullCowCartridge.generated.h"

#define _static static
#define cstatic

struct FBullCowCount
{
	int32 Bulls;
	int32 Cows;

	FBullCowCount()
	{
		Bulls = 0;
		Cows = 0;
	}
};

UCLASS(ClassGroup=(Custom), meta=(BlueprintSpawnableComponent))
class BULLCOWGAME_API UBullCowCartridge : public UCartridge
{
	GENERATED_BODY()

	public:
	virtual void BeginPlay() override;
	virtual void OnInput(const FString& Input) override;

	void SetupGame();
	void EndGame();
	void ProcessGuess(const FString & Guess);
	TArray<FString> & LoadWordsFromFile(const FString & sFichero, TArray<FString> & ListaDestino) const;
	TArray<FString> & GetValidWords(const TArray<FString> & ListaOrigen, TArray<FString> & ListaDestino) const;
	void MostrarLista(const TArray<FString> & Lista) const;
	void GetBullsCows(const FString& Guess, FBullCowCount& Count) const;

	// Puede ser static, y le quitamos el const
	// bool IsIsogram(const FString & Word) const;
	static bool IsIsogram(const FString & Word);

	// Your declarations go below!
	private:
	FString HiddenWord;
	int32 Lives;
	bool bGameOver;
	TArray<FString> Words;
};

And the “BullCowCartridge.cpp”

// Fill out your copyright notice in the Description page of Project Settings.

#include "BullCowCartridge.h"
#include "HiddenWordList.h"

#include "Misc/FileHelper.h"
#include "Misc/Paths.h"


void UBullCowCartridge::BeginPlay() // When the game starts
{
    Super::BeginPlay();

    SetupGame();
}

void UBullCowCartridge::OnInput(const FString& Input) // When the player hits enter
{
    if (bGameOver)
    {
        ClearScreen();
        SetupGame();
    }
    else
    {
        ProcessGuess(Input);
    }
}


void UBullCowCartridge::SetupGame()
{
    PrintLine(TEXT("Bienvenido a BullCowGame!"));

    TArray<FString> TempWords;
    TempWords = LoadWordsFromFile(TEXT("Datos/HiddenWordList.txt"), TempWords);
    Words = GetValidWords(TempWords, Words);

    int RamdomIndex = FMath::RandRange(0, Words.Num()-1);
    HiddenWord = Words[RamdomIndex];
    PrintLine(TEXT("Palabra Oculta: %s"), *HiddenWord);
    Lives=HiddenWord.Len();
    bGameOver=false;

    PrintLine(TEXT("Adivina la palabra de %i letras"), HiddenWord.Len());
    PrintLine(TEXT("Tienes %i vidas"), Lives);
    PrintLine(TEXT("Escribe tu apuesta y"));
    PrintLine(TEXT("pulsa Enter para continuar"));
}


void UBullCowCartridge::EndGame()
{
    bGameOver=true;
    PrintLine(TEXT("Pulsa Enter para jugar. (otra vez)"));
}


void UBullCowCartridge::ProcessGuess(const FString & Guess)
{
    if (Guess==HiddenWord)
    {
        PrintLine(TEXT("Has ganado!"));
        EndGame();
        return;
    }

    if (Guess.Len() != HiddenWord.Len())
    {
        PrintLine(TEXT("La palabra oculta tiene %i letras"), HiddenWord.Len());
        PrintLine(TEXT("Lo siento. Intenta adivinarla de nuevo."));
        PrintLine(TEXT("Te quedan %i vidas."), Lives);
        return;
    }

    if (!UBullCowCartridge::IsIsogram(Guess))
    {
        PrintLine(TEXT("Hay letras repetidas. Intentalo de nuevo"));
        return;
    }

    PrintLine(TEXT("Has perdido una vida"));
    --Lives;
    
    if (Lives<=0)
    {
        ClearScreen();
        PrintLine(TEXT("No te quedan Vidas"));
        PrintLine(TEXT("La palabra oculta es: %s"), *HiddenWord);
        EndGame();
        return;
    }

    FBullCowCount Counts;
    GetBullsCows(Guess, Counts);
    PrintLine(TEXT(" - Hay %i Cows, y hay %i Bulls"), Counts.Cows, Counts.Bulls);
    PrintLine(TEXT("Adivina otra vez. Te quedan %i vidas"), Lives);
}


void UBullCowCartridge::GetBullsCows(const FString& Guess, FBullCowCount& Counts) const
{
    for(int32 GuessIndex=0; GuessIndex<Guess.Len(); GuessIndex++)
    {
        if (Guess[GuessIndex] == HiddenWord[GuessIndex])
        {
            Counts.Bulls++;
            continue;
        }

        for(int32 HiddenIndex=0; HiddenIndex<HiddenWord.Len(); HiddenIndex++)
        {
            if (HiddenWord[HiddenIndex] == Guess[GuessIndex])
            {
                Counts.Cows ++;
                // No estan repetidas, porque son isogramas
                // lo mejor es salir.
                break;
            }
        }
    }
}


cstatic bool UBullCowCartridge::IsIsogram(const FString & Word)
{
    for (int32 Index=0; Index<Word.Len(); Index++)
    {
        for (int32 SubIndex=Index+1; SubIndex<Word.Len(); SubIndex++)
        {
            if (Word[Index] == Word[SubIndex])
            {
                return false;
            }
        }
    }

    return true;
}


TArray<FString> & UBullCowCartridge::LoadWordsFromFile(const FString & sFichero, TArray<FString> & ListaDestino) const
{
    ListaDestino.Reset();

    // El Operador / mete este '/' para concatenar los caminos de un fichero.
    const FString WordListPath = FPaths::ProjectContentDir() / sFichero;
    PrintLine(TEXT("Content: %s"), *sFichero);
    FFileHelper::LoadFileToStringArray(ListaDestino, *WordListPath);

    // MostrarLista(ListaDestino);

    return ListaDestino;
}


TArray<FString> & UBullCowCartridge::GetValidWords(const TArray<FString> & ListaOrigen, TArray<FString> & ListaDestino) const
{
    ListaDestino.Reset();

    for (FString palabra : ListaOrigen)
    {
        if (UBullCowCartridge::IsIsogram(palabra) && palabra.Len()>=4 && palabra.Len()<=8)
        {
            ListaDestino.Emplace(palabra);
        }
    }

    // MostrarLista(ListaDestino);

    return ListaDestino;
}


void UBullCowCartridge::MostrarLista(const TArray<FString> & Lista) const
{
    // compruebo contenido:
    for(int32 i=0; i<Lista.Num(); i++)
    {
        PrintLine(TEXT("+ %i %s"), i, *Lista[i]);
    }
}

This last version from the first compilation is obviously different from the first compilations, but the compilation average is between 100 and 500 seconds.

(It does not make sense that we talk about the example of a person, who increases the compilation in 20 seconds, when I speak to you about 200 seconds)

But I am already telling you, that is for all the codes that I am compiling.
I have resigned myself, and I continue as I can with the course.

I wish it was a problem with my code but it is not.
You already said it, I don’t have the right equipment.

Although I still insist that

> the UE compilation is killing flies with cannon shots

Otherwise, forgive me if I seem very vehement, and thanks for the effort.

.

1 Like

I’m not seeing anything major anyway.

I did a test with the code you posted above and the initial build took 200+ seconds. But, I don’t have all the project files as you have them so this is with an error during build and its not additional builds so can’t do a full 1 to 1 test.

Anyway, since you are seeing “compilation average is between 100 and 500 second” then its likely just normal and slow because of all the things its doing over only VS code that you’re used to. UE4 has its own stuff and its not perfect so the times can range.

Either way, if you simply load the default project resource for the course before modifications (which is the reference time I posted above) and the time is low then its simply because there’s more things to do as you add more. You seem to have the file fix in there for the slow times that I linked above and don’t seem to be including the slower headers so its likely normal unless someone notices something else.

Yes, you should just move on and enjoy the course further :slight_smile:

Thank you anyway.
And yes, I will continue with what I have.

I tried to see if I could generate a solution in VStudio 2019, but what it generates is wrong, and incomplete, when precisely it is using the VS 2019 Cl compiler (Toolchain).

I guess when I have a little more time I’ll try to guess how it’s doing and see if I can finish compiling it myself, but that, when I have time …
and above all more knowledge.

For now to continue learning.
Thank you.
I will enjoy it.
:wink:

You did not add ; at last

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms