Performance issue
Javerages opened this issue ยท 14 comments
Hi,
The astral sorcery collisions seem to take a lot of server time, for example for a creeper +-70% of server time is attributed to astral:
In total this increases the creepers servertime to 4% of total server time. Spread over all mobs this is a significant load on our server.
Can this be solved in a more efficient manner?
What version of Astral Sorcery, how long was this taken over, and can you provide the full profile output file?
Profile created 06:20p.m. on 22-12-2020, interval 4ms
Forge version "35.1.13" (server), Minecraft 1.16.4, All the mods 1.3.7
It seems to be consistent for all entities.
This was the short profile (15 seconds or so) that I was looking at https://spark.lucko.me/#EHfMQawLbn
It looks like this was recently added here for an aevitas mantle effect https://github.com/HellFirePvP/AstralSorcery/blob/1.16-indev/src/main/resources/coremods/add_custom_voxel_collision.js#L28
I'll post a longer profile in a bit
Okay, but what Astral Sorcery version, @Javerages ? There's been several performance bugs fixed in fairly recent releases.
And definitely need a longer profile.
Version 1.13.8 @Doomgull (me and @Javerages play on the same server)
new profile - about 3 minutes long this time https://spark.lucko.me/#R8o0lrjt9G
It seems a major part of this is just the JVM resolving an object's identity hash.
I'll ASM in a new flag which circumvents this i suppose.
Edit: as a side note, i somewhat expected a performance hit, though i didn't expect it to be the object's hashing
Would you mind testing again with
https://jenkins.hellfiredev.net/job/AstralSorcery/job/1.16-indev/59/artifact/astralsorcery-1.16.4-1.13.9.jar
@HellFirePvP thanks, I've tested it but unfortunattely it doesn't look like it helped much.
Here's 2 different samples:
For now I've just removed the 2 ASM patches that had the most impact on CPU load (add_custom_voxel_collision.js and add_enchantment_helper_levels.js) as they don't seem important for the stuff we use from the mod, it seemed to help quite a bit (tick time went from 60ms to 45)
I'll further narrow it down by only generating additional collision if it's needed for the given entity; i guess that's faster than that currently.
If it comes down to it in the future, i suppose i'll need to see to something more performant than Java's native Object hashcode evaluation.
@HellFirePvP Thanks, looks like it requires much less resources to run now:
https://spark.lucko.me/#w8miNnTwLm
Great work ๐
Resolution accepted, thank you @lucasvanhalst and @HellFirePvP for the great work ๐