@brutus5000 said in Removal of the Blinking lights:
Can you tell us a little more how the new implementation avoids the performance issues of the original one?
Great question!
In general I don't think / am able to observe a significant performance issue with the previous or the current implementation when I reviewed it last month. In comparison to other changes such as #4539 or #3857 or the fact that a single formation (every order that involves some form of movement (!)) happily allocates 4kb of memory and can take several milliseconds to complete. I made a mistake by removing the blinking lights and by re-introducing it I'm rectifying the mistake .
In general the current implementation follows a few principles:
-
(1) No unnecessary memory allocations. Especially the type of 'use and forget' is exceptionally painful for performance. Not only is memory allocation on the heap slow in general, it also unnecessarily flushes the CPU cache.
-
(2) No unnecessary table access. Everything in Lua that involves :
or .
is not as 'cheap' as it is in compiled languages and involves a hash operation in combination with following a pointer into (random) memory. This expensive! And it compounds since our Lua is interpret and not compiled. As a quick example #5524 increases the performance of the score graph at the end of the game by several factors and the primary reason for this was to cache table accesses.
And unrelated to performance:
I hope that answers your question