# UNDF: UNDF-2026-000000309 Fixes threejs-0001: WebGLUniformsGroups.allocateBindingPointIndex() uses Array.indexOf() inside a for loop — O(n²) binding point allocation, fires per material per frame. --- a/src/renderers/webgl/WebGLUniformsGroups.js +++ b/src/renderers/webgl/WebGLUniformsGroups.js @@ -... (module scope, near allocatedBindingPoints declaration) - const allocatedBindingPoints = []; + const allocatedBindingPoints = []; // preserved for compatibility (indexOf used at line 377) + const allocatedBindingPointsSet = new Set(); // FIX threejs-0001: O(1) membership — CWE-407 function allocateBindingPointIndex() { for ( let i = 0; i < maxBindingPoints; i ++ ) { - if ( allocatedBindingPoints.indexOf( i ) === - 1 ) { // O(n) per iteration — CWE-407 + if ( ! allocatedBindingPointsSet.has( i ) ) { // O(1) — fixed allocatedBindingPoints.push( i ); + allocatedBindingPointsSet.add( i ); return i; } } } # Also maintain set in the release path (wherever allocatedBindingPoints.splice() is called): + allocatedBindingPointsSet.delete( index ); # Simpler alternative: replace allocatedBindingPoints array entirely with a Set, # change indexOf usage at line 377 to has(). No backward compat concern — internal only.