Which are the slowest frequently applying nodes in Unreal Engine?

I did, but the profiler does not show the list of actual blueprint functions that are taking most of the time.

If you were using c++ you could take advantage of SCOPED_NAMED_EVENT

and then use stat named events to track the firing

1 Like

I could be wrong, but I think if you use the C++ profiler in Visual Studio, you can see the blueprint functions. I’m rebuilding the engine now so I can’t check right this minute.

I use. Here is the screenshot:


How to use it to determine the most slow functions?

Do you have a higher resolution screenshot? It’s blurry on my end.

Here is this screenshot in the archive.
2024-11-23_20-30-35.7z (702.7 KB)

.h

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

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "ExampleActor.generated.h"

UCLASS()
class YOUR_API AExampleActor : public AActor
{
	GENERATED_BODY()
	
public:	
	// Sets default values for this actor's properties
	AExampleActor();

protected:
	// Called when the game starts or when spawned
	virtual void BeginPlay() override;

public:	
	// Called every frame
	virtual void Tick(float DeltaTime) override;


	UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
	void MyCustomFunctionTimed();
	virtual void MyCustomFunctionTimed_Implementation();
};

cpp

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



#include "ExampleActor.h"

DECLARE_STATS_GROUP(TEXT("MyCustomFunctionTimed"), STATGROUP_CustomFunctions, STATCAT_Funk);
DECLARE_CYCLE_STAT(TEXT("MyCustomFunctionTimed"), STATGROUP_CustomFunctions, STATGROUP_StatSystem);




AExampleActor::AExampleActor()
{

	PrimaryActorTick.bCanEverTick = true;

}


void AExampleActor::BeginPlay()
{
	Super::BeginPlay();	
}


void AExampleActor::Tick(float DeltaTime)
{
	Super::Tick(DeltaTime);

}

void AExampleActor::MyCustomFunctionTimed_Implementation()
{
	SCOPE_CYCLE_COUNTER(STATGROUP_CustomFunctions); // <==here is where you add a cycle counter

	for (int32 i = 0; i < 200; i++) {		
		UE_LOG(LogTemp, Warning, TEXT("Doing work %s"), *FString::FromInt(i));
	}
}


As you can see custom function shows up in the unreal insights.

Inside of the actor I just call the event via a timer to trigger it

Those are impressive numbers. It’s hard to tell if it’s GPU or your BP. There are indeed a lot of CPU stalls. But I don’t think this should affect the GPU timings though I can’t rule it out.

FRDGBuilder is the render dependency graph. That’s taking up 41ms. It seems to be struggling to collect all the assets in your level for rendering.

The translucency, subsurface scattering and custom depth are taking 25.8ms. What do you have that uses subsurface scattering? And do you have a lot with transparency? Also seeing a lot with the landscape subsystem. Custom depth should never be that long. Do you have water or something in your level?

Can you turn off foliage? Just set it to not visible in game. Does that make a difference? Just want to see if we can track down what’s causing the issue. If you have water, try disabling that too.

As to finding your function list, can you click on the “Total Inclusive Time” or “Incl” header so that the values are in descending order (seconds, then ms, then us)?

Also, just to rule it out… can you check your project settings->Engine->Garbage Collection and make sure the “Time Between Purging Pending Kill Objects” is not low. Around 60 seconds is the default I think.

edit: Landscape seems to be an issue as well. Not sure if it’s related to foliage or something to do with the landscape materials. Or the size of the landscape.

1 Like

Do I need to look at each material to see this?

For example, windows.

Yes, I have water.

No, it doesn’t.

Material shader is complex but all the textures are just 1K.

24 km2 are in the memory from the point where I test.

I think you can disable SSS with the console command “r.SSS.Scale 0”. See if that makes a difference.

There’s a stat in the stat dropdown in the editor viewport called “Game”. It should list how much time is spent in blueprints, ticks and other things. Maybe post a screenshot of that. For comparison, my game has a BP time of 0.02ms per frame. Tick time is 1 to 2ms per frame depending how many actors are active.

Other stats you may find useful. GPU, Landscape, Unit.

Would also like to see the trace sorted by Incl.

I still think the landscape is causing issues as well. You could temporarily replace the material, but I’m not sure that’s the only issue.

Here is a screenshot of “stat game” from “Play Standalone”:


Do I understand right that the biggest exclusive time matters, and it is PerformOverlapQuery?

Why so many simultaneous overlaps constantly calculated? Do you have an interaction system that has the overlaps on the items checking for the player?

If so then reverse the pickup logic so that the player overlaps and gathers the item to interact with instead. You will lower the overhead that way.

Can we get the Unit stats as well? Interested to see the game time vs render time as well as the number of triangles you’re pushing.

Yes, overlaps are the issue here.

Clearly, animations and overlaps are really standing out here. To me, if I had to make a guess, is that your collision and overlap settings are set incorrectly. So when your actors move, the components are animated and are triggering overlap events between the components on the same actor. That’s my guess. It’s the simplest thing I can think of that would cause that many overlaps.

You have WAY too many scoped movement updates. That’s very peculiar. These are usually used for custom animations like climbing. Scoped movement is where you do an update multiple times on the same component, but the results of itself or the child components aren’t broadcasted until it leaves the scope. Other than climbing and maybe a parcour game, not sure where else this would be used. But the main point is even then, you’d have maybe a few of these per frame, not hundreds or thousands.

How many actors do you have in your level that move around and have multiple scene components? Check the animations and the collision/overlap settings.

Start disabling overlap events on anything and everything that doesn’t need it. And from what I’m seeing, I’d start with everything that’s animated.

edit: Exclusive means it’s just that method alone. That won’t tell you much unless you sort by exclusive. Inclusive is where you should look at it tells you the time for itself along with everything else it is calling. For example, movement shouldn’t take 9ms. Overlaps shouldn’t take 7.64ms. It shouldn’t even show up at all.

1 Like

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