Open Terrain Generator (OTG)

Open Terrain Generator (OTG)

10M Downloads

MobSpawnGroupHelper.toMinecraftClass() is making worlds take a lot longer to load, optimization suggestion inside

Corosauce opened this issue ยท 3 comments

commented

In a current setup I have, it's taking about 40 seconds to load a world in singleplayer, got impatient and had a peek with visualvm to see where the majority of the work is happening.

Found 2 cases where the string replace work in MobSpawnGroupHelper.toMinecraftClass is REALLY adding up.

I'm sure theres lots of higher level optimizations that could be done but I can't be certain where and how without more analysis. At a minimum I would suggest you process the entries of EntityList.getEntityNameList() and store your own version of it to lookup, and then use that to compare against in MobSpawnGroupHelper.toMinecraftClass instead of the string replace work every time.

Here are the 2 cases in visualvm where it is used, adding up to about 20 seconds of a 43 second world load:

screenshot_20190201_215713

screenshot_20190201_215957

commented

Hey @Corosauce, that's very helpful, thanks! What kind of world were you using for these tests, was it using a lot of configs with a lot of mob spawning settings?

commented

Have added a cache in v7_DEV_r23 so each name is only queried once, will be in the v7 release. Performance optimisation is one of the last big things I'm doing for the v7 release for Forge, so if you have any more recommendations, please let me know :). Thanks again!

commented

I didnt setup the server myself but have been helping with it randomly, I believe its Biome Bundle via OTG, here is the modlist: https://gist.github.com/Corosauce/74431be080c93fdf1adab7bdcadbe62f

Speedy followup, nice!

I was debugging the client trying to find some performance issues a week or 2 ago and might have spotted some things, but I wasnt sure if they were worthy of posting, but I might as well, ill open another issue for client related possible problems.