Skip to content

Avoid numpy.delete() — use column indexing for better performance and readability #26

@SaFE-APIOpt

Description

@SaFE-APIOpt

normals2D=numpy.delete(normals,1,1)

In the line:
normals2D = numpy.delete(normals, 1, 1)
numpy.delete() creates a copy of the array and performs internal data shifting, which introduces unnecessary overhead. Since the goal here is simply to exclude the second column, a more efficient and readable alternative is to use column indexing directly:
normals2D = normals[:, [0, 2]]
This approach avoids extra memory allocation and improves clarity, especially in performance-critical operations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions