ontrigger / ValheimPerformanceOptimizations

MIT License
33 stars 5 forks source link

load world partially threaded #8

Closed MSchmoecker closed 3 years ago

MSchmoecker commented 3 years ago

This reduces the loading time of big worlds. My tested world had about 800000 ZDOs which took about 10 sec to be processed by ZDOMan.Load(). With this patch it was reduced by 4 sec. If a world is bigger the gain is even better and in a small world it creates no significant impact either way. It doesn't load ZDO data right away but store them in an array to load them threaded with C# Parallel. In my testing this needed about 350MB of RAM but it is released when the functions ends.

I only patch the current data version, when it changes in a future patch it falls back to the vanilla version.

ontrigger commented 3 years ago

Looks good, but is it possible that num2 < batch?

ontrigger commented 3 years ago

yep, it breaks badly image