Geom builder allows to do addPosition([x, y, z]) and addPosition(x, y, z) to avoid vector allocation. To enable this I use arguments parameter. Turns out it allocates a lot of junk in Firefox causing GC hiccups and has impact on CPU in Safari and Chrome as well.
//1 old
GeomBuilder.prototype.addPosition = function (pos) {
var values = arguments[0].length ? pos : arguments
//2 new, best
GeomBuilder.prototype.addPosition = function (pos) {
var values = pos
// 3 better than 1, but still slower than 2
GeomBuilder.prototype.addPosition = function (...pos) {
var values = pos[0].length ? pos[0] : pos
Geom builder allows to do
addPosition([x, y, z])
andaddPosition(x, y, z)
to avoid vector allocation. To enable this I usearguments
parameter. Turns out it allocates a lot of junk in Firefox causing GC hiccups and has impact on CPU in Safari and Chrome as well.