[1.7.10/1.12.2] Lag in EventHandler.onEntitySpawnCheck
LemADEC opened this issue ยท 4 comments
Description of the issue:
4 to 7% lag is observed in warmroast on our server with ~1500 entities, 19 players :
There's no functions calls reported in the profiler below onEntitySpawnCheck(). From the source code, we can see thread synchronization, so that's probably what's causing the issue here.
For the record, disabling the spawn prevention won't prevent the lag source.
I do observe the same code design on 1.12 branch, hence this report.
Consider using a threadsafe data structure instead of relying on synchronization.
Since entities are spawning much more frequently than lantern/lights are loaded/placed, the interdictionTiles array is read much more frequently than it's written. As such, we could replace ArrayList with a CopyOnWriteArray and remove all related synchronizations.
Crashlog:
not applicable
Versions & Modlist
ImmersiveEngineering-0.7.7
Forge-1.7.10-1614
https://www.technicpack.net/modpack/arcania-craft.654713/mods
Despite observing the same design, I would still encourage testing this with an actual latest version, given that Minecraft and Forge's architecture changed quite a lot inbetween.
I don't consider reports filed on a 2 1/2 year old version to be valid anymore.
Sounds like you've no idea what thread synchronization implies, that makes me sad.
Sounds like you've no idea what kind of changes can occur in two and a half years, that makes me sad.
Always check your bug reports against the latest version, people. The whole point of different versions is that there are changes, and not just in IE itself.
I've fixed lots of bugs in others mods on 1.5.2, 1.6.4, 1.7.10, 1.9.4, 1.10.2 and 1.12.2 in the last 5 years. Sorry, I've hardly touched 1.8.x and 1.11.x, that makes me completely inexperienced in Minecraft.
Now, sure, you can continue deflecting the problem and start attacking me on my programming experience or whatever other creative pretext. The issue remains and it's still version independent.