Cyclops Core

Cyclops Core

111M Downloads

Excessive calls to RegistryKey.getOrCreateKey from DimPos cause immense lag

DBotThePony opened this issue ยท 4 comments

commented

Issue type:

  • ๐ŸŒ Performance issue

Short description:

DimPos.isLoaded() call down to RegistryKey.getOrCreateKey, which call String.intern(), which is utterly slow

public RegistryKey<World> getWorldKey() {
return RegistryKey.getOrCreateKey(Registry.WORLD_KEY, new ResourceLocation(getWorld()));
}

Xming_4J5yQqZ7TA
Xming_wUzjV3FGTT

You might notice that first trace has AE2 in it and discard report that it is caused by AE2. But it is not. E.g. for example, if you crouch with The One Probe installed and look at crafting interface, entire server will freeze for several seconds (the bigger is item network the longer will be the freeze), because it want to display some of items in tooltip. "Freeze" doesn't happen when you crouch look at enormous colossal chest for example, containing all the items exposed by ID network. And DimPos will be the king in sampler report.

Steps to reproduce the problem:

  1. Have something that use DimPos (e.g. IntegratedDynamics)
  2. Enjoy onPostServerTick take more than half of tick time.

Versions:

  • This mod: 1.16.5-1.11.5
  • Integrated Dynamics: 1.16.5-1.7.1
  • Minecraft: 1.16.5
  • Forge: 1.16.5-36.1.4

Profiler output:

cyclops_dimpos.zip

commented

Thanks for reporting!

commented

Here is sampling file for over 7 hours of server runtime: cyclops_longer_profile.zip

commented

Forgot to mention that server is running under Linux Ubuntu Server 20.10, kernel version 5.9.1-050901-generic, Minecraft Server itself is running under GraalVM 21.0.0.2 (which is faster than regular HotSpot JVM).

Since some mods seem to perform much worse under Linux until getting performance fixes, I am making sure you can reproduce the problem and implement fixes (you can easily setup Linux under VirtualBox, performance of console apps under VirtualBox are very close to bare metal).

Please look into this as soon as possible, because it is the only slow part about Integrated Dynamics (excluding NBT comparisons) and it tank performance of server no matter how complicated ID networks are.
Xming_vz6OYpk7T5

commented

Please look into this as soon as possible

If it needs to be done quickly, you're welcome to submit a PR with a fix yourself.
I can't guarantee when I'll be able to look into this. I do all of this in my free time (whenever I have some to spare).