You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 19, 2021. It is now read-only.
Chunks in the World are currently stored in a HashMap. Rust uses a collision-resistant cryptographic hash by default (SipHash), which can be quite slow for small keys (and AxialPoint is very small).
A few different approaches should be implemented and compared:
Use a different hashing algorithm, but keep the HashMap
This requires the key to be Ord, which AxialPoint isn't. To keep AxialPoint clean, a private newtype wrapper can be implemented which implements PartialOrd and Ord (we can also just #[derive] it on AxialPoint for simplicity - but < and > on points doesn't really make sense).
Use a sparse vector holding a fixed NxN grid of chunks
This should be very fast, but you'll have to actually think a bit about what you're doing since the player can move around in the world (might need deeper integration than just world.rs)
... any other ideas?
If the chunk storage efficiency doesn't cause any practical problems, this isn't very important. But if anyone wants to fix this anyways, feel free to.
The text was updated successfully, but these errors were encountered:
i remembered sometime ago reading about "voxel engines" one part of it was read times of different types of different data structures.
if i remember correctly it turned out that "Interval tree + hashing" is by far one of the best ways if you do not have random reads, which isn't really the case here.
Chunks in the
World
are currently stored in aHashMap
. Rust uses a collision-resistant cryptographic hash by default (SipHash), which can be quite slow for small keys (andAxialPoint
is very small).A few different approaches should be implemented and compared:
HashMap
BTreeMap
Ord
, whichAxialPoint
isn't. To keepAxialPoint
clean, a private newtype wrapper can be implemented which implementsPartialOrd
andOrd
(we can also just#[derive]
it onAxialPoint
for simplicity - but<
and>
on points doesn't really make sense).world.rs
)If the chunk storage efficiency doesn't cause any practical problems, this isn't very important. But if anyone wants to fix this anyways, feel free to.
The text was updated successfully, but these errors were encountered: