Skip to content

Text Decoding #1470

Closed
Closed
@eXponenta

Description

@eXponenta

Currently a loader use String.fromCharCode for decoding a text from wasm-memory to JS-string.

I created test that compare current implementation with TextDecoder.
For popular browser (Safari, Chrome, Firefox) it faster that String.fromCharCode
For Safari on iOS14 TextDecoder is extrimely faster (about 10 times).

Test
https://esbench.com/bench/5f6c9945b4632100a7dcd322

Results
image
Left - FF (Latest), Right - Chrome (Latest)

image
IOS 14 Safari Ipda 2018

UPD:

For strings lequal 30 chars String.fromCharCode runs faster that TextDecoder in Chrome, for FF and Safari on my devices this does not apply.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions