That's a very good point, TJ. Thanks. Chang
On Mon, Aug 5, 2013 at 4:30 PM, Tab Atkins Jr. <[email protected]> wrote: > On Mon, Aug 5, 2013 at 12:41 PM, Simon Pieters <[email protected]> wrote: >>> var newarr = new Int32Array(); >>> window.atob(encodedData, newarr); //decode base-64 string back to integer >>> array >>> //newarr[0] should be 1, newarr[1] should be 2 and newarr[2] should be 3. >> >> Is there a reason to support an arbitrary typed array for atob rather than >> returning a new typed array? >> >> e.g. >> >> var newarr = atob(encodedData, {typedarray:true}); >> >> (I'm not sure which view is most appropriate to return.) > > Decoding into a given typed array means you can reuse the same > (potentially large) buffer multiple times, rather than creating new > ones with every call. Avoiding the GC churn can be significant. It > also means you can decode several strings into the same typed array at > different offsets. > > ~TJ
