On Thursday, 22 July 2021 at 03:13:14 UTC, seany wrote:
If there are multiple possibilities, what is the fastest in terms of memory? Thank you.
I believe the fastest way (as seen from your loop) would be using pointer arithmetric and using void* keys for diagonalLengths and an index function that is able to pick the void* key/address from the given double coordinates.
You may also consider using a binary tree data structure instead of AA.