optimization for v8
not effective as I expected because of cost of new Array