News for hackers. Stuff that matters.
Re:Victor.js – 2D Vectors for JavaScript by FrozenCow on Saturday August 30, 2014 @04:59PM (#8247583)
Nice clean library. I guess the vector object is kept mutable because of performance reasons? When actually calculating with this I see a lot of copying (and thereby allocating) going on. For a while I've been looking for a library that is immutable, but also is fast (minimal allocations).

I was thinking of the use of a JS sugaring compiler that splits the vector up into into 2 numbers (2 arguments for functions, 2 variables when declaring, etc). Alternatively some way to combine the two numbers into one and splitting them again each time the vector is used. Both give you an immutable vector implementation that also has 0 allocations.

This can make a big difference in usability and performance for game-like applications. Any ideas?

There are no comments on this comment yet.