Vlad It is not clear to me why the result you indicated would be ranked better than #2 result in my results
The purpose of the query js physics own vector class
was to find the specific link I mentioned. I used words/phrases that seemed unique to that page, and that page only. I do this a lot if I remember reading something online, but don't remember the exact link. In these cases, I usually want to share the link with someone, or (re)read the page myself. That is why Kagi's result #2 is not as useful as Google's top result.
Even if the purpose was not to find that exact link, the general question was: "why should JS physics engines avoid defining their own Vector classes?"
The answer that satisfied this question was:
Also, avoid vector objects if at all possible (as in vector2 with x and y properties). While again it may be convenient to have functions return these objects so they can change or return both values at once, you can easily end up with hundreds of these created every frame, resulting in terrible GC performance.
Although this quote is not from the reddit page, it is from the main link that reddit page is discussing.
Compare to the Kagi #2 ranked result: https://jonobr1.com/Physics/
This page is simply documentation for a specific JS physics library. It uses its own Vector class, so it seems the author thinks this is a good idea. I wanted to know why this is a bad idea.