Closed Aeledfyr closed 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. :)
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. :)
This PR:
RefCell
withMutex
,RwLock
, orOnceCell
's sync variantRc
withArc
Send + Sync
bounds to all traits so that their trait objects are thread-safeonce_cell
, I replaced the uses oflazy_static
withonce_cell
image
crate (this change is mostly unrelated to threading and I can remove it if necessary)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 theRegionBuffer::for_each_chunk
function rather than unlocking it and relocking it many times (in eachchunk_location
call).Fixes #46.