Reika_Mods_Issues icon indicating copy to clipboard operation
Reika_Mods_Issues copied to clipboard

[DragonAPI] Excessive time spent by IWG.DungeonGenerator on FindFirstFile() during server tick

Open MalTeeez opened this issue 1 year ago • 3 comments

Profiling a world in an already generated area shows ChromatiCraft.World.IWG.DungeonGenerator.isGennableChunk() taking up over 40% of tick time. Following the stacktrace it leads down to WindowsNativeDispatcher.FindFirstFile0() 2 times, once from DungeonGenerator.updateNoisemaps() and once from DungeonGenerator.getNearbyZones(). While the profiler was running I did not move (only turned my head) so no new chunks should have been generated in that time. It should also be noted that in this scenario the profiler only recorded ticks that took at least 150% longer than normal tick duration, so (leading to) in this case lagspikes, not constant slowdown.

[Part 1 from profiler results] image

[Part 2 from profiler results] image

MalTeeez avatar Apr 16 '23 22:04 MalTeeez

This also seems to be appearing during normal generation, a profiler result from that: https://spark.lucko.me/XjBUJoF7Pj

MalTeeez avatar Apr 22 '23 02:04 MalTeeez

I added some caching that should help.

ReikaKalseki avatar Jul 03 '23 02:07 ReikaKalseki

Apparently this is still affecting people.

ReikaKalseki avatar Jan 19 '24 20:01 ReikaKalseki