4 ms·
It's probably best to keep a Float64Array view into the ArrayBuffer around, and use that repeatedly instead of constructing a fresh one each time. The interpre
by kannanvijayan 9y ago
It's probably best to keep a Float64Array view into the ArrayBuffer around, and use that repeatedly instead of constructing a fresh one each time.
The interpreters and baseline JITs will always construct the object because they can't inline and they don't do whole-method analysis.. and the heavyweight JITs _probably would_ inline the constructor, then notice that the constructed array does not escape, then scalarize the whole thing down to a single read...
but hey, why work the optimizer so hard when you can just make life easy for it and do a single allocation up front, and it runs fast in all performance tiers, and performance isn't predicated on a particular optimization strategy being utilized.
- trgv 9y agoThanks for the advice, very helpful.