Summary
extrudeWalls.js creates new vec3 arrays inside nested loops, causing GC pressure during extrusions.
Usage Frequency: HIGH
Called by extrudeFromSlices() which powers all extrusion operations:
extrudeLinear() / extrudeLinearGeom2()
extrudeRotate()
extrudeHelical()
Typical model usage: Every extruded shape. A model with 5 extrusions with 32 segments each = 160+ calls to extrudeWalls, each creating many vec3 arrays.
Problem
File: packages/modeling/src/operations/extrusions/extrudeWalls.js
Lines: 32-39
edges.forEach((edge) => {
const increment = vec3.subtract(vec3.create(), edge[1], edge[0]) // New array
vec3.divide(increment, increment, divisor)
let prev = edge[0]
for (let i = 1; i <= multiple; ++i) {
const next = vec3.add(vec3.create(), prev, increment) // New array in inner loop
newEdges.push([prev, next])
prev = next
}
})
For each edge, this creates 1 + multiple vec3 arrays. With many edges and multiple > 1, this generates significant allocations.
Suggested Fix
Reuse temporary vectors:
const tempIncrement = vec3.create()
edges.forEach((edge) => {
vec3.subtract(tempIncrement, edge[1], edge[0])
vec3.divide(tempIncrement, tempIncrement, divisor)
let prev = edge[0]
for (let i = 1; i <= multiple; ++i) {
const next = vec3.clone(prev) // Still need new arrays for storage
vec3.add(next, next, tempIncrement)
newEdges.push([prev, next])
prev = next
}
})
Note: The inner loop still needs allocations since edges are stored, but the increment calculation can be reused.
Impact
Medium - contributes to GC pressure during extrusion operations. More noticeable with high segment counts.
Summary
extrudeWalls.jscreates new vec3 arrays inside nested loops, causing GC pressure during extrusions.Usage Frequency: HIGH
Called by
extrudeFromSlices()which powers all extrusion operations:extrudeLinear()/extrudeLinearGeom2()extrudeRotate()extrudeHelical()Typical model usage: Every extruded shape. A model with 5 extrusions with 32 segments each = 160+ calls to extrudeWalls, each creating many vec3 arrays.
Problem
File:
packages/modeling/src/operations/extrusions/extrudeWalls.jsLines: 32-39
For each edge, this creates 1 +
multiplevec3 arrays. With many edges and multiple > 1, this generates significant allocations.Suggested Fix
Reuse temporary vectors:
Note: The inner loop still needs allocations since edges are stored, but the increment calculation can be reused.
Impact
Medium - contributes to GC pressure during extrusion operations. More noticeable with high segment counts.