[Bf-blender-cvs] [41eb33794cc] master: Cleanup: Add comment about suspicious O(n^3) loop
Hans Goudey
noreply at git.blender.org
Mon Aug 30 05:13:02 CEST 2021
Commit: 41eb33794ccd977582185159791805c84730a957
Author: Hans Goudey
Date: Sun Aug 29 22:12:53 2021 -0500
Branches: master
https://developer.blender.org/rB41eb33794ccd977582185159791805c84730a957
Cleanup: Add comment about suspicious O(n^3) loop
===================================================================
M source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cube.cc
===================================================================
diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cube.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cube.cc
index ccf7065f7b0..1de3942b462 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cube.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cube.cc
@@ -90,6 +90,10 @@ static void calculate_vertices(const CuboidConfig &config, MutableSpan<MVert> ve
int vert_index = 0;
+ /* Though looping over all possible coordinates inside the cube only to skip them may be slow,
+ * the alternative is similar complexity to below in the poly index calculation. If this loop
+ * becomes a problem in the future it could be optimized, though only after proper performance
+ * testing. */
for (const int z : IndexRange(config.verts_z)) {
for (const int y : IndexRange(config.verts_y)) {
for (const int x : IndexRange(config.verts_x)) {
More information about the Bf-blender-cvs
mailing list