Skip to content

[dart2wasm] String.codeUnitAt on a const String is ~10x slower than equivalent Uint8List access. #63484

@modulovalue

Description

@modulovalue

String.codeUnitAt on a const _OneByteString is much slower on dart2wasm than on every other Dart backend, and ~10x slower than indexing an equivalent Uint8List on dart2wasm itself.

Benchmark: sum _LUT[a[i]] best of 5 rounds in microseconds.

JIT AOT dart2js dart2wasm
const String + codeUnitAt 50 k 43 k 73 k 786 k
hoisted Uint8List 61 k 61 k 105 k 66 k

Full repro: https://gist.github.com/modulovalue/7c4bed1762166a6e776265d0fc9abde3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions