Skip to content

pts_norms_squared: remove unnecessary allocation #938

@arrayka

Description

@arrayka

When pts_norms_squared is provided, the code still clones it with to_vec(), allocating O(num_points) extra memory even though the values are only read. This can be avoided by keeping it as a borrowed slice when present (and only allocating when norms need to be computed).

Originally posted by @Copilot in #933 (comment)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions