zlacker

How fast can browsers process base64 data?

submitted by mfigui+(OP) on 2025-11-29 07:30:30 | 49 points 24 comments
[view article] [source] [go to bottom]

NOTE: showing posts with links only show all posts
1. danhau+Fd[view] [source] 2025-11-29 10:49:12
>>mfigui+(OP)
> However, when decoding, we must handle errors and skip spaces.

This had me scratching my head. Why would a base64 decoder need to skip spaces? But indeed, MDN documents this behavior:

> Note that: The whitespace in the space is ignored.

JS never ceases to surprise. Also, check out that typo :D

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...

3. adzm+hEl[view] [source] 2025-12-05 23:52:25
>>mfigui+(OP)
https://chromium-review.googlesource.com/c/v8/v8/+/7208125 v8 changed yesterday to avoid the temp buffer which will likely double the base64 decode speed.

Looks like this was brought up there as a result of this article too, which is neat! And helpful since I was just messing with a node script that is heavily decoding base64

◧◩
15. Retr0i+4Wl[view] [source] [discussion] 2025-12-06 02:41:11
>>alain9+3Ml
He's already done that: https://github.com/simdutf/simdutf?tab=readme-ov-file#base64 (see also https://github.com/lemire/fastbase64 )
◧◩
19. adzm+L2m[view] [source] [discussion] 2025-12-06 03:47:53
>>tasn+xJl
A few big things and lots of small things.

Big performance wins recently optimizing some core operations:

https://bugzilla.mozilla.org/show_bug.cgi?id=1994067 https://bugzilla.mozilla.org/show_bug.cgi?id=1995626

which brings it near chrome performance without the new v8 optimizations.

Still more work to do, including avoiding extra copies just like v8, and exploring more simd etc. Generic slow items for toBase64 and fromBase64: https://bugzilla.mozilla.org/show_bug.cgi?id=2003299 https://bugzilla.mozilla.org/show_bug.cgi?id=2003305

extra copying of results: https://bugzilla.mozilla.org/show_bug.cgi?id=2003461 https://bugzilla.mozilla.org/show_bug.cgi?id=1996197

No reason all browsers would not be able to be similar in performance eventually. Pleased this was noticed and being worked on by both v8 and Firefox team

[go to top]