Skip to content

Consider decode() with offset/length #219

Open
@inexorabletash

Description

@inexorabletash

Context: https://bugs.chromium.org/p/chromium/issues/detail?id=1093980

When decoding a subset of an ArrayBuffer, the API currently requires the creation of a new view (Uint8Array) to encapsulate the byte offset/length. High performance applications try to avoid creating temporaries to reduce GC impact.

The request is to support a form of decode() which takes a buffersource, byte offset, and length. This could be done e.g. as:

decoder.decode(bufferSource, {offset, length});

(Although in real high-performance code the caller would re-use the options object.)

IIRC we talked about this in the distant past and decided "no, views are how you do this" but we now have developer feedback that this is a bottleneck. Improving the performance of bindings/GC is possible, but this API shape has a seemingly unnecessary overhead imposed by requiring views.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions