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.
[2.1.12] Performance regression from 1.1 with calculate_tile_properties
[2.1.12] Performance regression from 1.1 with calculate_tile_properties
- Attachments
-
- sfmp-nullius-perf2.zip
- (72.26 MiB) Downloaded 6 times
-
- nullius.zip
- (39.04 MiB) Downloaded 2 times
-
- factorio-current-2.1.log
- (11.96 KiB) Downloaded 1 time
-
- 07-21-2026, 20-10-40.png (8.4 MiB) Viewed 214 times
-
- 07-21-2026, 20-07-07.png (9.95 MiB) Viewed 214 times
-
zhuyifei1999
- Manual Inserter

- Posts: 3
- Joined: Wed May 06, 2026 9:52 am
- Contact:
Re: [2.1.12] Performance regression from 1.1 with calculate_tile_properties
To clarify regarding CompiledMapGenSettings::createContext:
In 2.0 and 2.1 it is called from luaSurface::luaCalculateTileProperties. This function calls into CompiledMapGenSettings::addDefaultControlSettingConstants which iterates on every TilePrototype, EntityPrototype, and DecorativePrototype (and others but they have negligible cost), and calls CompiledMapGenSettings::addFsrControlSettingConstants, which performs lots of std::map operators, where the vast majority of time in this lua wrapper is spent.
In 1.1, the call site from luaSurface::luaCalculateTileProperties -> CompiledMapGenSettings::createContext is not there. I did not profile 1.1 but I assume it is simply not called at all within this lua wrapper.
In 2.0 and 2.1 it is called from luaSurface::luaCalculateTileProperties. This function calls into CompiledMapGenSettings::addDefaultControlSettingConstants which iterates on every TilePrototype, EntityPrototype, and DecorativePrototype (and others but they have negligible cost), and calls CompiledMapGenSettings::addFsrControlSettingConstants, which performs lots of std::map operators, where the vast majority of time in this lua wrapper is spent.
In 1.1, the call site from luaSurface::luaCalculateTileProperties -> CompiledMapGenSettings::createContext is not there. I did not profile 1.1 but I assume it is simply not called at all within this lua wrapper.
Re: [2.1.12] Performance regression from 1.1 with calculate_tile_properties
Thanks for the report. I found some things to optimize however the noise-logic rework that happened in 2.0 means this logic is always going to be slower than 1.1. It's intended usage is you make a list of positions you want the info for and then call it once - it looks like the mod usage is calling it per-position it wants info for.
If you want to get ahold of me I'm almost always on Discord.

