[convert] On web, consider using atob
and btoa
to implement Base64 codec
#52007
Labels
area-core-library
SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.
area-web
Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop.
library-convert
type-enhancement
A request for a change that isn't a bug
type-performance
Issue relates to performance or code size
web-dart2js
It has been reported that Base64 decoding using the browser
atob
function followed by a copy loop to convert the result string into aUint8List
is 4-5x faster that usingBase64.decode
.The main part of the decoder loop looks reasonable (other than the clumsy handling of
outIndex++
which is not where the time is spent)It seems that using
atob
will be worthwhile.We did use
TextDecoder
to accelerate the decoding of UTF8 bytes into strings. Using the browser methods for Base64 conversion probably has similar issues:The text was updated successfully, but these errors were encountered: