Small performance improvement for subsurf

r43572: Skip subsurf normal allocation/calculation when not needed.

CCGSubsurf, the code behind the subsurf modifier, stores “grids” of subdivided data, one grid for each corner of a face. Each element of the grid contains a coordinate stored as three floats. It can also calculate normals, adding another three floats to each element.

When a mesh has UV layers, the subsurf modifier can (optionally) subdivide UV coordinates. This is done as a separate calculation from subdivision of the mesh’s face/edge data, because the connectivity of faces might look different from the UV perspective (think seams.) Because of this difference, a whole new CCGSubsurf object is created, calculated, and destroyed for each UV layer.

The change introduced in this commit is to simply disable normals calculation when it’s not needed (as in the case of UV layers.) So subdivision should runs a little bit faster and uses a little bit less memory (only during subdivision itself though; the output will use the same amount of memory, so the “Mem” number in the header will look the same.)

Leave a Reply

Your email address will not be published. Required fields are marked *