[2.1.12] Performance regression from 1.1 with calculate_tile_properties
Posted: Tue Jul 21, 2026 5:26 pm
In Nullius, shooting an Arboriculture drone makes numerous calls to LuaSurface.calculate_tile_properties. The code that does so remained untouched from what it was at 1.1 era, where it ran fast enough to not cause a significant lag spike.
In latest 2.0, and also latest 2.1, this causes a massive lag spike that I've traced down to the `calculate_tile_properties` api call, which is called 200+ times. I know it's not ideal. I have a change made to minimize this to one call with 16 points and I interpolate the rest which is a lot faster, but I think it was still rather expensive.
Someone ran a C++ level profiler and it seems most of the time is spent in CompiledMapGenSettings::createContext.
You can use the attached save file with latest 2.0 and mods from the mod portal. To the far south there's a spidertron next to a character, there's a recent ping for it. Use that spidertron to shoot the drone at your feet and you'll get the lag spike. You can probably mouse over the body and press U to take it to use more easily.
The same save with the WIP 2.1 port of nullius I've attached can be used to load on Factorio 2.1.12.
In latest 2.0, and also latest 2.1, this causes a massive lag spike that I've traced down to the `calculate_tile_properties` api call, which is called 200+ times. I know it's not ideal. I have a change made to minimize this to one call with 16 points and I interpolate the rest which is a lot faster, but I think it was still rather expensive.
Someone ran a C++ level profiler and it seems most of the time is spent in CompiledMapGenSettings::createContext.
You can use the attached save file with latest 2.0 and mods from the mod portal. To the far south there's a spidertron next to a character, there's a recent ping for it. Use that spidertron to shoot the drone at your feet and you'll get the lag spike. You can probably mouse over the body and press U to take it to use more easily.
The same save with the WIP 2.1 port of nullius I've attached can be used to load on Factorio 2.1.12.