Skip to content

Reduce memory garbage in fromBufferGeometry and mergeVertices. #14394

@ngokevin

Description

@ngokevin
Description of the problem

Geometry.fromBufferGeometry and mergeVertices has some temp arrays and objects:

Examples are like tempNormals, tempUVs, tempUVs2. And in mergeVertices, unique, changes, faceIndicesToRemove

Also if Geometry.fromBufferGeometry is getting called from one of the three.js Geometries (e.g., BoxGeometry), can have a flag that tells fromBufferGeometry to not need to clone like the bounding box, just share the reference since the buffer geometry is discarded.

Examples are like boundingBox.clone() and boundingSphere.clone().

Perhaps I'll end up moving to use BufferGeometry completely later (we do bunch of accessing of the faces array), but should be easy to improve memory a bit in these two methods.

Three.js version
  • Dev
  • r94
Browser
  • All of them
  • Chrome
  • Firefox
  • Internet Explorer
OS
  • All of them
  • Windows
  • macOS
  • Linux
  • Android
  • iOS
Hardware Requirements (graphics card, VR Device, ...)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions