I am currently writing a mod and have noticed that the "Checksum for script __my_mod__/control.lua" step takes longer than usual. It used to be almost instant, but now takes 3-4 seconds and is noticable when loading a savegame for example.
Is there any way to get more info about what is taking so long, maybe like a hotspot analysis?
"Checksum for script __my_mod__/control.lua" suddenly takes longer
- BiterUnion
- Inserter
- Posts: 21
- Joined: Fri Aug 19, 2022 7:58 am
- Contact:
Re: "Checksum for script __my_mod__/control.lua" suddenly takes longer
I think the log file will show the timing for calculating the CRCs, maybe with verbose logging enabled
- BiterUnion
- Inserter
- Posts: 21
- Joined: Fri Aug 19, 2022 7:58 am
- Contact:
Re: "Checksum for script __my_mod__/control.lua" suddenly takes longer
Thanks for the quick reply!
I am pretty sure calculating the CRCs is what is taking so long, so I was hoping there was a way to find out exactly what part of the calculation takes up most of the time. Unfortunately verbose logging does not output that.
Could you maybe give me one or two pointers what the CRC is actually calculated for? Is it a CRC for the Lua code only or also the global data? In other words, should I look into reducing code size (although I don't have particularly much code) or global data (also not that much), or cross references in global data, or something else to speedup CRC calculation?
I am pretty sure calculating the CRCs is what is taking so long, so I was hoping there was a way to find out exactly what part of the calculation takes up most of the time. Unfortunately verbose logging does not output that.
Could you maybe give me one or two pointers what the CRC is actually calculated for? Is it a CRC for the Lua code only or also the global data? In other words, should I look into reducing code size (although I don't have particularly much code) or global data (also not that much), or cross references in global data, or something else to speedup CRC calculation?
Re: "Checksum for script __my_mod__/control.lua" suddenly takes longer
Can you provide a log and a save game?
- BiterUnion
- Inserter
- Posts: 21
- Joined: Fri Aug 19, 2022 7:58 am
- Contact:
Re: "Checksum for script __my_mod__/control.lua" suddenly takes longer
Sure, thanks for your help.
Last edited by BiterUnion on Sat Feb 04, 2023 6:02 pm, edited 1 time in total.
Re: "Checksum for script __my_mod__/control.lua" suddenly takes longer
The crc calculation is essentially instant. All of the time is spent in the function call to the results of requiring "__testorio__.init"
This part:
Specifically almost all of the time is spent making and populating lua tables.
I'm not sure what the testorio mod aims to do; but it looks like it will likely have issues due to it overwriting the 'require' function which factorio itself already overwrites and implements differently.
This part:
Code: Select all
{
'tests.core.Class', 'tests.core.Error', 'tests.core.Helper', 'tests.core.List', 'tests.core.Callback',
'tests.events.EventHandler',
'tests.gui.Component', 'tests.gui.WindowManager',
'tests.gui.factorio.FactorioComponent'
}
I'm not sure what the testorio mod aims to do; but it looks like it will likely have issues due to it overwriting the 'require' function which factorio itself already overwrites and implements differently.
If you want to get ahold of me I'm almost always on Discord.
- BiterUnion
- Inserter
- Posts: 21
- Joined: Fri Aug 19, 2022 7:58 am
- Contact:
Re: "Checksum for script __my_mod__/control.lua" suddenly takes longer
I use testorio for unit testing. But if it is only the testing that takes time, then that's not an issue.
Many thanks again!
Many thanks again!