Skip to content

Conversation

@bevzzz
Copy link
Collaborator

@bevzzz bevzzz commented Jul 25, 2025

This PR replaces usages of Float[] and Float[] with their primitive doubles across the client. We do not gain anything from working with objects here and only create unnecessary for the GC. See 7cfcb6b for details.

Some small cleanups and refactors too.

Resolves #424

bevzzz added 4 commits July 25, 2025 17:00
We started off using Float[] and Float[][] because v5 did so
and it was easier to reuse (read: copy-paste) some bits of code.

Thing with object arrays is that they name N allocations (1 for each element)
compared to 1 that a primitive array makes.
That creates unnecessary work for GC and we aren't gaining anything from
using boxed values.

They're still useful for request parameters like distance/certainty/force,
because they can be null. But vectors are not sparse and should never contain
nulls in principle.
@bevzzz bevzzz self-assigned this Jul 25, 2025
Copy link

@orca-security-eu orca-security-eu bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca

@bevzzz bevzzz merged commit 9260049 into v6 Jul 28, 2025
2 checks passed
@bevzzz bevzzz deleted the v6-primitive-float branch July 28, 2025 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

v6(proposal): use float[] and float[][] to represent vectors instead of boxed Float[] / Float[][]

3 participants