How you easily measure the time it takes a block of C++ code to run?

In that case you can always do something like:

FDateTime StartTime = FDateTime::UtcNow();
ExpensiveFunction();
float TimeElapsedInMs = (FDateTime::UtcNow() - StartTime).GetTotalMilliseconds();
UE_LOG(LogTemp, Display, TEXT(“%f”), TimeElapsedInMs)

You can also use GetTotalMicroseconds, or GetTotalSeconds, accordingly.

EDIT: Just saw that you mentioned this approach in your original post, but I will leave this here in case anyone else is interested

4 Likes