Next talk (perhaps to the walls)...
Some Performance Notes - previously I figured out not very funny slow downs in scripted executions used in UT Editor - talking about that "Please upgrade to" 469d version.
Let's consider that I did some tests out of Editor - in run-time. A small mutator using XC_Engine support with clocking feature was supposed to count Navigation Point Actors in three different maps using 4 methods: "foreach AllActors" native C++ iterator from Engine, then UScripted methods based on NavigationPointlist as follows:
"for" cycle, "while" and "do-until".
Such as:
Code: Select all
function Mutate(string MutateString, PlayerPawn Sender)
{
local navigationpoint n;
local float Time[2];
local int np;
if ( MutateString ~= "nodes" )
{
class'XC_CoreStatics'.static.Clock(Time);
foreach AllActors ( class 'NavigationPoint', n )
np++;
log("Foreach Interator counted "$np$" nodes in"@class'XC_CoreStatics'.static.UnClock(Time)@"seconds.");
np = 0;
class'XC_CoreStatics'.static.Clock(Time);
for ( n = Level.NavigationPointlist; n != None; n = n.nextNavigationPoint )
np++;
log("For Cycle counted "$np$" nodes in"@class'XC_CoreStatics'.static.UnClock(Time)@"seconds.");
np = 0;
class'XC_CoreStatics'.static.Clock(Time);
n = Level.NavigationPointlist;
while (n != None)
{
np++;
n = n.nextNavigationPoint;
}
log("WHILE Linked list counted "$np$" nodes in"@class'XC_CoreStatics'.static.UnClock(Time)@"seconds.");
np = 0;
class'XC_CoreStatics'.static.Clock(Time);
n = Level.NavigationPointlist;
do
{
np++;
n = n.nextNavigationPoint;
}
until ( n == None );
log("DO-UNTIL Linked list counted "$np$" nodes in"@class'XC_CoreStatics'.static.UnClock(Time)@"seconds.");
np = 0;
}
if ( NextMutator != None )
NextMutator.Mutate(MutateString, Sender);
}
Notes - Now it's clear that a linked list with many elements works actually slower than "foreach AllActors" iterator - mid finger at PawnList in MonsterHunt with 1000+ creatures - it doesn't help at all.
Resuming - results from these maps (counting Navigation Nodes) comparing UT 440 with UT 469d.
PerfChecks wrote:
Performance Clocking Tests
UT 440
ScriptLog: Foreach Interator counted 180 nodes in 0.000015 seconds.
ScriptLog: For Cycle counted 180 nodes in 0.000026 seconds.
ScriptLog: WHILE Linked list counted 180 nodes in 0.000012 seconds.
ScriptLog: DO-UNTIL Linked list counted 180 nodes in 0.000011 seconds.
ScriptLog: Foreach Interator counted 562 nodes in 0.000027 seconds.
ScriptLog: For Cycle counted 562 nodes in 0.000084 seconds.
ScriptLog: WHILE Linked list counted 562 nodes in 0.000042 seconds.
ScriptLog: DO-UNTIL Linked list counted 562 nodes in 0.000038 seconds.
ScriptLog: Foreach Interator counted 751 nodes in 0.000025 seconds.
ScriptLog: For Cycle counted 751 nodes in 0.000100 seconds.
ScriptLog: WHILE Linked list counted 751 nodes in 0.000044 seconds.
ScriptLog: DO-UNTIL Linked list counted 751 nodes in 0.000040 seconds.
UT 469d
ScriptLog: Foreach Interator counted 180 nodes in 0.000016 seconds.
ScriptLog: For Cycle counted 180 nodes in 0.000027 seconds.
ScriptLog: WHILE Linked list counted 180 nodes in 0.000014 seconds.
ScriptLog: DO-UNTIL Linked list counted 180 nodes in 0.000014 seconds.
ScriptLog: Foreach Interator counted 562 nodes in 0.000028 seconds.
ScriptLog: For Cycle counted 562 nodes in 0.000080 seconds.
ScriptLog: WHILE Linked list counted 562 nodes in 0.000036 seconds.
ScriptLog: DO-UNTIL Linked list counted 562 nodes in 0.000035 seconds.
ScriptLog: Foreach Interator counted 751 nodes in 0.000028 seconds.
ScriptLog: For Cycle counted 751 nodes in 0.000103 seconds.
ScriptLog: WHILE Linked list counted 751 nodes in 0.000049 seconds.
ScriptLog: DO-UNTIL Linked list counted 751 nodes in 0.000046 seconds.
In a single case linked list in UT469d was faster a bit - in the most of cases it's not faster than UT 440, and that's all for run-time checks.
Drawing conclusion:
In the age when machines were slower and optimizing codes would be very needed, EPIC did not bother to do the fastest methods.
"for" cycle compared to "While" and "do-until" it's clearly slower. On a PIII in 1999 this was not the best ever solution - these linked lists are widely used in BotPack for finding PlayerStarts, sorting "AlternatePath", etc. to not forget "PawnList"... Yeah, truly great...