Comment by stephantul
10 hours ago
Amazing post, I didn’t think this through a lot, but since you are normalizing the vectors and calculating the euclidean distance, you will get the same results using a simple matmul, because euclidean distance over normalized vectors is a linear transform of the cosine distance.
Since you are just interested in the ranking, not the actual distance, you could also consider skipping the sqrt. This gives the same ranking, but will be a little faster.
It's stuff like this I would have loved to know when I was doing game engine dev in the 90s.
I want to do game programming again like it's 1999. No more `npm i` or "accept all cookies" :/ rant off :)
Go make a game for the Sega Genesis https://mdengine.dev/
Or, the GameBoy Advance https://github.com/GValiente/butano