Summary
The condition in TAABBTree::ProgressCopyTimeSliced() appears reversed.
What Type of Bug are you experiencing?
Framework
Steps to Reproduce
The condition in TAABBTree::ProgressCopyTimeSliced() appears reversed.
Current code:
CurrentDataElementsCopiedSinceLastCheck++;
if (CurrentDataElementsCopiedSinceLastCheck >
FAABBTimeSliceCVars::MinDataChunkToProcessBetweenTimeChecks)
{
CurrentDataElementsCopiedSinceLastCheck = 0;
return bCanContinueCopy;
}
const double ElapsedTime =
FPlatformTime::Seconds() - StartSliceTimeStamp;
The comment states that platform time should only be checked after processing a configured number of elements. However, the current implementation checks the time for every element up to the threshold, then skips the check once the threshold is exceeded.
With the default threshold of 500:
- Elements 1–500 perform a time query.
- Element 501 skips the time query and resets the counter.
- The pattern then repeats.
This is the opposite of the intended behavior and causes unnecessary calls to FPlatformTime::Seconds().
Expected Result
Skip the time check until the configured number of elements has been processed, then perform one time check and reset the counter.
Observed Result
This is the opposite of the intended behavior and causes unnecessary calls to FPlatformTime::Seconds().
Affects Versions
5.7
Platform(s)
Windows