mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-13 08:35:20 +02: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:
@@ -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;
|
||||
|
Reference in New Issue
Block a user