Hi all,
My studio has had a bit of a rough one with 5.8 but it has generally being pretty good. I finally looked into an editor performance problem we’ve been having since upgrading from 5.6 to 5.8 and traced it to Epic’s new Database engine “TEDS”.
We have a main game world using streaming levels with 33k actors and 100’s of folders. This is a very high actor count world obviously, but usually there’s only a few thousand actually visible at a time.
In UE 5.6 with no streaming levels visible, we’d hit ~150fps in the level editor.
In UE 5.8 with no streaming levels visible, we only get about ~40fps, and obvious performance problems once we started actually making actors visible, and especially when testing.
Unreal Insights revealed a MassEntityEditorSubsytem Processor called “Resolve hierarchy rows” taking up around 6ms of frame time. This task, I think, fixes up missing data in “relational” columns between rows of linked tables in the database.
One relationship in the database is between Actors and Folders, and i think it resolves that relationship by iterating over all rows (ie, all actors and all folders) in the database, every single frame.
I tested this by adding about 10k actors to a blank world and discovering no performance issue at all, until I started putting them in folders and the framerate started plummeting, with this database “query” being the source.
The code in question starts at Line 567 of “EditorDataStorageHierarchyImplementation.cpp”.
auto ProcessorQuery = Select(
TEXT("Resolve hierarchy rows"),
FProcessor(EQueryTickPhase::PrePhysics, CoreProvider.GetQueryTickGroupName(EQueryTickGroups::Default)),
[this, Handle](IQueryContext& Context, RowHandle Row)
{
const FRegisteredHierarchy* Hierarchy = FindRegisteredHierarchy(Handle);
FEditorDataHierarchyUnresolvedParent_Template* UnresolvedParentColumn;
{
const int RowIndexInChunk = Hack_FindRowIndexInChunk(Context, Row);
check(RowIndexInChunk != INDEX_NONE);
void* HierarchyDataComponentArrayStart = Context.GetMutableColumn(Hierarchy->UnresolvedParentColumn);
uint8* HierarchyDataComponentObjectAddress = static_cast<uint8*>(HierarchyDataComponentArrayStart) + (RowIndexInChunk * Hierarchy->UnresolvedParentColumn->GetStructureSize());
UnresolvedParentColumn = reinterpret_cast<FEditorDataHierarchyUnresolvedParent_Template*>(HierarchyDataComponentObjectAddress);
}
RowHandle ParentRow = Context.LookupMappedRow(UnresolvedParentColumn->MappingDomain, UnresolvedParentColumn->ParentId);
if (Context.IsRowAvailable(ParentRow))
{
// Routes through HierarchyAccessInterface -- each backend's SetParentRow
// handles the correct storage (Legacy: adjacency-list column; Relations: CreateRelation).
Context.SetParentRow(Row, ParentRow);
Context.RemoveColumns(Row, {Hierarchy->UnresolvedParentColumn});
}
});
Being an “FProcessor” makes it run every frame, no matter what. However, there is also an “FObserver” “OnAdd” or “OnRemove” query type. I changed it to an FObserver::OnAdd, at line 569:
FObserver(FObserver::EEvent::Add, Hierarchy->UnresolvedParentColumn),
And this fixed the performance problem. It feels like I should put an extra copy of this in for “OnRemove” too.
The class that owns this code is a major part of how TEDS works (one of the 14 different components in the “environment”), but it’s barely documented, so I have no idea if I’ve broken some undocumented assumption by changing this from something that runs every frame. So have I?
I hope this little investigation helps someone elses quite-large project XD
As a sidenote, the “TEDS” Plugin is labelled Experimental, but you can’t turn it off without losing Bridge and a bunch of the Chaos physics plugins, if you are also in this pickle.