Open DeckerMMIV opened 7 years ago
I can confirm that optimization works very well. On quad core Intel i7 CPU @2.90 GHz recalculation on GCV is reduced from 1:46 minutes to 19 seconds.
Hallo an Dzi4d3K.
Besteht die Möglichkeit die geänderte Vesion von dir zu bekommen ?
mfg Martin
Hallo an Dzi4d3K.
Besteht die Möglichkeit die geänderte Vesion von dir zu bekommen ?
mfg Martin
Late but income, click the link below then https://raw.githubusercontent.com/Stephan-S/AutoDrive/a0e22f793c5bf8def3be87c4f5b3bae61ecdb6c1/Mod/AutoDrive.lua
register file into browser, go to file register under and u got your "AutoDrive.lua" to replace into the .zip file mod. Br
I've reduced the number of array-lookups and did some tweaks in the function/method, which for me resulted in a speed-boost when recalculating the graph.
Using locals are quicker in LUA (link), than searching through a multi-dimensional-array, so that is why I replaced
self.ad.<member>
with anewPaths.<member>
, and reworked usage ofself.ad.Q[start][setToUse]
so there is no need to do multiple lookups.Also discovered that there is no need to make a deep-copy of the
Graph
intoQ
. An array of the 'unvisited' nodes will suffice, so that is why I've made a shallow-copy ofgraph
into localworkGraph
(previouslyQ
), which directly references the elements ingraph
, as these elements are not modified when this function is doing its task.Another trick with LUA, is that the indices of an array/table can have gaps - so it is actually not an 'array' as such. With this knowledge, I could see an optimization of the
for i2 in pairs(self.ad.Q) do ... if inQ == true then
, and changed it to do a direct-lookup if a wanted waypoint-id was still in theworkGraph
table (array).