[1.1.70] Poor performance when large quantities of spidertrons congregate in one location
Posted: Sat Oct 29, 2022 8:56 pm
If a large number of spidertrons attempt to stand in the same location, game update starts taking longer and longer.
Steps to reproduce:
Spawn 1000 spiders in a 2x2 chunk area (fully paved and free of any obstructions):
This idles with entity update taking around 1.0ms. Now let's send all the spiders to stand in one spot:
As the spiders approach the location, entity update rapidly rises. It quickly peaks around 2500ms and then slowly settles down to about 1200ms.
Steps to reproduce:
Spawn 1000 spiders in a 2x2 chunk area (fully paved and free of any obstructions):
Code: Select all
for i=1,1000 do
local x = -32 + 64*math.random()
local y = -32 + 64*math.random()
local e = game.surfaces.nauvis.create_entity({name="spidertron", position={x,y}, force=game.forces.player, create_build_effect_smoke=false})
end
Code: Select all
for _, spider in pairs(game.surfaces.nauvis.find_entities_filtered{name="spidertron"}) do
spider.autopilot_destination = {0,0}
end