mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-17 17:08:39 +00:00
Trivially optimize iteration order in loops
Due to how node data is stored iterating X last provides better cache locality.
This commit is contained in:
parent
2efd0996e6
commit
92d03f3832
4 changed files with 35 additions and 38 deletions
|
@ -185,9 +185,9 @@ void Environment::continueRaycast(RaycastState *state, PointedThing *result_p)
|
|||
}
|
||||
|
||||
// For each untested node
|
||||
for (s16 x = new_nodes.MinEdge.X; x <= new_nodes.MaxEdge.X; x++)
|
||||
for (s16 z = new_nodes.MinEdge.Z; z <= new_nodes.MaxEdge.Z; z++)
|
||||
for (s16 y = new_nodes.MinEdge.Y; y <= new_nodes.MaxEdge.Y; y++)
|
||||
for (s16 z = new_nodes.MinEdge.Z; z <= new_nodes.MaxEdge.Z; z++) {
|
||||
for (s16 x = new_nodes.MinEdge.X; x <= new_nodes.MaxEdge.X; x++) {
|
||||
MapNode n;
|
||||
v3s16 np(x, y, z);
|
||||
bool is_valid_position;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue