use typedarray, about 15% faster