Skip to content

Unecessary string concatanation in WebGLRenderer #14554

@oguzeroglu

Description

@oguzeroglu

var geometryProgram = geometry.id + '_' + program.id + '_' + ( material.wireframe === true );

Instead of string concatanation in this line, _currentGeometryID, _currentProgramID and _currentWireframe variables should be defined and compared to the geometryId, programID and wireframeID seperately:

if (_currentGeometryID != geometryID || _currentWireframe != wireframe || _currentProgramID != programID){
  updateBuffer = true;
   // update _currentGeometryID, _currentWireframe and _currentProgramID variables
}

String concatanation causes GC activity since it creates a new string each time and this function is called on each frame. The GC activity caused by this line may be observed using Chrome's Allocation Profiler.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions