Hi! I have been profiling modded Celeste maps recently. The GetSensitivity function of SensitiveFlags.cs has a measurable performance impact (around 1.3% of Update time in an average map) even when Chronia Helper is not used at all. This seems to be because of Regex use, which is not cheap performance wise. The function gets called multiple times per frame through MapProcessor.OnLevelUpdate -> ChroniaFlagUtils.SetFlag -> SensitiveFlags.GetSensitivity.
Perhaps a decent solution would be caching whether flags are sensitive? A dictionary lookup seems like it would be significantly cheaper than a Regex check. Maybe you can think of other solutions as well.
Lmk if you have any questions! :)
Hi! I have been profiling modded Celeste maps recently. The GetSensitivity function of SensitiveFlags.cs has a measurable performance impact (around 1.3% of Update time in an average map) even when Chronia Helper is not used at all. This seems to be because of Regex use, which is not cheap performance wise. The function gets called multiple times per frame through MapProcessor.OnLevelUpdate -> ChroniaFlagUtils.SetFlag -> SensitiveFlags.GetSensitivity.
Perhaps a decent solution would be caching whether flags are sensitive? A dictionary lookup seems like it would be significantly cheaper than a Regex check. Maybe you can think of other solutions as well.
Lmk if you have any questions! :)