I originally posted this in Mod Help but after further thought I believe it's a bug so I'm posting it here.
Using: Factorio 10.2 x64 - note this doesn't seem to happen on 0.9.8 x64 which is what makes me believe it's a bug.
Mod: https://www.dropbox.com/s/ep4dae8r6wgjc ... acking.zip
I'm attempting to track all water bodies generated in the world by chunk and link them if they connect. Right now the mod does that but I'm having a strange issue where the game's performance drops off quickly with the more chunks explored.
Now, I expect it to take longer to generate chunks due to the water-body checking I'm telling it to do but even after it's finished chunk generation and background chunk generation the game still lags massively compared to without the mod.
How to reproduce: Load Factorio 0.10.2 x64, Install the mod and generate a new world - turn the game speed up to allow background chunk generation to do its thing or explore a decent amount and watch the "Update Time" on the debug screen. It climbs steadily even though the "Script Update" section shows the mod never uses over 0.2 MS(while exploring)/0.06 (on average when background generation runs) and nothing once background chunk generation is done.
Note: using Factorio 0.9.8 and the exact same mod files the issue doesn't happen what so ever - it runs as expected: increased load during chunk generation and zero impact when not generating chunks.
[0.10.2][kovarex] Chunk generation + my mod slows the game
[0.10.2][kovarex] Chunk generation + my mod slows the game
If you want to get ahold of me I'm almost always on Discord.
Re: [0.10.2][kovarex] Chunk generation + my mod slows the ga
Hello,
the problem is, that the mod generates quite huge amount of data that is stored in the lua context. (script.dat was bigger than level.dat in my test save).
This causes the lua garbage collector to take much much longer time than usual. The garbage collection was called every tick and now it is called once per 300 ticks, so it is better, but for larger saves it still is a problem, as lags the game every 5 seconds a bit).
It might get better later on, when we use the luajit and limit the garbage collector to certain amount of time per tick.
the problem is, that the mod generates quite huge amount of data that is stored in the lua context. (script.dat was bigger than level.dat in my test save).
This causes the lua garbage collector to take much much longer time than usual. The garbage collection was called every tick and now it is called once per 300 ticks, so it is better, but for larger saves it still is a problem, as lags the game every 5 seconds a bit).
It might get better later on, when we use the luajit and limit the garbage collector to certain amount of time per tick.