owengage / fastnbt

Fast serde serializer and deserializer for Minecraft's NBT and Anvil formats
MIT License
186 stars 34 forks source link

Improve multithreading support #48

Closed Aeledfyr closed 2 years ago

Aeledfyr commented 2 years ago

This PR:

Some of these changes likely have some performance overhead; two potential improvements would be reworking heightmap caching so that it only needs to be updated once and can use once_cell, and sharing the lock in the RegionBuffer::for_each_chunk function rather than unlocking it and relocking it many times (in each chunk_location call).

Fixes #46.

owengage commented 2 years ago

Looks good! I'll try this in a few full world renders as an informal benchmark soon. I don't expect the locking to have much impact. :)

owengage commented 2 years ago

Quick renders of hermitcraft season 8's world download:

multithread: 
    8.847
    9.100
    8.900
    8.851

master:
    8.890
    8.936
    8.747
    8.840

standard deviations:
multithread support: 8.92 +- 0.1
master: 8.85 +- 0.07

No significant different here as far as I'm concerned. Thank you for the contribution. :)