Page 1 of 1

[13.10] find_entities_filtered is sometimes very slow

Posted: Fri Jul 22, 2016 11:35 pm
by tux_mark_5
When using find_entities_filtered to find a player under specific position in every 4th tick, factorio lags massively.
This worked fine (with no performance penalty) in 13.9. The code is used in Magnet mod to check if the player is active (whatever that means).

Basically, running this code every several ticks takes more than 40 ms per update:

Code: Select all

local index = player.position
player.surface.find_entities_filtered{area={index,index}, name="player"}

Re: [13.10] find_entities_filtered is sometimes very slow

Posted: Fri Jul 22, 2016 11:44 pm
by Rseding91
Yeah that's going to scan the entire surface since the bounding box is zero.

The mod needs to be re-written and update for 0.13.