Skip to content

zstd support #54

Description

@ricea

Issue for discussion of adding support for the zstd format to the API.

Activity

  1. ricea commented on Apr 3, 2023

    @ricea
    CollaboratorAuthor

    Currently libzstd is not linked into Chromium. It would add roughly 700KB to the binary size (maybe can be trimmed a bit). This would be a hard sell if the compression standard is the only user.

  2. evanstade commented on Jul 14, 2023

    @evanstade

    It seems that you did manage to trim the size a bit as this change only added 38k. Was that just by dropping everything besides decompression, or were there other tricks you made use of?

    On the storage team we are also interested in using zstd for compressing IndexedDB values before sending them over IPC (or storing as blobs). Adding the compression half of zstd appears to add another 200kB.

    So that's at least two users of zstd.

  3. ricea commented on Jul 18, 2023

    @ricea
    CollaboratorAuthor

    We didn't do anything special in Chromium to reduce the size increase, except for only compiling in the decompression code. I think we were just lucky.

    I would like to move this specification to WHATWG before we add new features, since it is now implemented in Firefox and Safari and we would like to have consensus.

    That means it will probably be some months before there's movement on adding zstd.

  4. saschanaz commented on Jul 18, 2023

    @saschanaz
    Member

    I would like to move this specification to WHATWG before we add new features, since it is now implemented in Firefox and Safari and we would like to have consensus.

    Why would it take that much to move to WHATWG?

  5. telgareith commented on Nov 21, 2023

    @telgareith

    Note: Chrome/Chromium, Firefox, and Opera have agreed to add zstd to content-encoding options. Chrome is planning on General Availability in 118.

  6. Jedipedia commented on May 16, 2024

    @Jedipedia

    Another note: Firefox now supports Content-Encoding: zstd as of version 126 but there's still no support for new DecompressionStream("zstd") in either Firefox or Chromium.

  7. xpl commented on Jun 24, 2024

    @xpl

    Please add it to the specification, as it seemingly blocks from implementing new DecompressionStream("zstd") in browsers:

    https://issues.chromium.org/issues/348499728

    Screenshot 2024-06-24 at 12 10 32
  8. saschanaz commented on Sep 10, 2024

    @saschanaz
    Member

    #34 (comment)

    Just as brotli, we'd be open to ship only DecompressionStream support for zstd, as @jesup reported 600KB size increase to ship the compression side of the library.

  9. ricea commented on Sep 11, 2024

    @ricea
    CollaboratorAuthor

    #34 (comment)

    Just as brotli, we'd be open to ship only DecompressionStream support for zstd, as @jesup reported 600KB size increase to ship the compression side of the library.

    Thanks. I think this will also be Blink's position.

  10. nektro commented on Sep 27, 2024

    @nektro
    Member

    Bun would be interested in supporting this since we already ship with zstd support internally for other APIs

  11. CraigglesO commented on Feb 18, 2025

    @CraigglesO

    I heavily use DecompressionStream for gzip. I would love to see brotli and zstd support for this as reading data is drastically more useful/common in browsers than writing. Commenting to understand better the process here. Will this become a priority within the next year or so?

  12. ricea commented on Feb 19, 2025

    @ricea
    CollaboratorAuthor

    We need someone to write an implementation, a PR to update this specification, and web platform tests. Or three separate people, it doesn't matter.

    At the last W3C TPAC we reached an agreement in principle to add this to the standard, someone just needs to do the work.

    Unfortunately Chromium won't be able to ship this until there is some real-world usage, due to the binary size problem.

  13. saschanaz commented on Feb 19, 2025

    @saschanaz
    Member

    Did we? I think we only agreed about brotli.

  14. ricea commented on Feb 19, 2025

    @ricea
    CollaboratorAuthor

    @saschanaz My recollection is that we had a proper agreement for Brotli, and someone suggested we apply it to zstd too, and there was a general sense of agreement. However, if you think there's more to be done to get agreement for zstd, I'm happy to wait for that.

  15. saschanaz commented on Feb 19, 2025

    @saschanaz
    Member

    I remember (and per the meeting minutes) I checked again about zstd at the end of the meeting and everyone said brotli only... But maybe I'm wrong?

    (if others are fine with it, Mozilla would be happy to consider exposing our ongoing zstd implementation)

  16. kenrussell commented on Feb 27, 2025

    @kenrussell
    Member

    Colleagues and I would like to see zstd support in DecompressionStream in support of the GPU texture "supercompression" format Basis Universal. This file format contains blocks of zstd-compressed coefficients. It is already used by libraries like Three.js and is a recommended texture format in glTF - both for texturing geometry in 3D web apps. Direct decompression support in the browser would reduce the size of WebAssembly modules which operate on these files. From our standpoint, compression support isn't needed. Thanks in advance for considering this; we're hoping this gets standardized.

  17. nektro commented on Nov 22, 2025

    @nektro
    Member

    Bun shipped as "zstd" in v1.3.3.

  18. kenrussell commented on Jan 26, 2026

    @kenrussell
    Member

    Firefox added support for brotli and zstd to CompressionStream/DecompressionStream in mdn/browser-compat-data#28619 and linked issues / PRs. Is it possible to move forward this support across browsers?

  19. saschanaz commented on Jan 26, 2026

    @saschanaz
    Member

    (To be clear Gecko never shipped zstd but only implemented it behind a pref. And decoding only.)

  20. kenrussell commented on Jan 27, 2026

    @kenrussell
    Member

    Sorry, I meant to say "behind a pref" - thanks for the correction.

    From our partners' standpoint, support only in DecompressionStream would still be helpful, if compression support is difficult, or increases code size too much.

  21. tim-tim707 commented on May 13, 2026

    @tim-tim707

    NianticLabs recently switched from gzip to zstd compression for Gaussian Splatting Compression. ( nianticlabs/spz#73 )
    Edit: Added link to the blog post https://www.nianticspatial.com/blog/spz4

    For our ($COMPANY) web gaussian splatting viewer we can use DecompressionStream("gzip") in order to not ship a wasm module for decompression and would love to be able to use a DecompressionStream("zstd") for this new version as well.

  22. saschanaz commented on May 13, 2026

    @saschanaz
    Member

    Every implementation should have zstd decoder so nothing should really block shipping. How much are we concerned about having only decoder?

    My standpoint still stays same as in 2024 TPAC: Either we ship both or decoder only, the spec should specify so (and not make it optional) and we should have a good cross-vendor agreement that enough implementations are willing to ship, to prevent webcompat issues.

  23. saschanaz commented on May 13, 2026

    @saschanaz
    Member

    We lack WebKit voice here; filed WebKit/standards-positions#667.

  24. Jedipedia commented on Jul 14, 2026

    @Jedipedia

    Having spent some time with Firefox's native new DecompressionStream("zstd") (enabling dom.compression_streams.zstd.enabled in about:config), our feedback is:

    Performance is 10x faster than the fzstd JavaScript library we were using before. But if we use a WASM library like the bokuweb port of Facebook's original zstd library we get identical performance to the native new DecompressionStream("zstd").

    file size native fzstd bokuweb zstd-wasm-dec
    2 MB 5 41 3 5
    6 MB 14 120 14 14
    5.5 MB 16 121 15 20
    11 MB fail 254 37 fail
    10 MB fail 195 21 fail

    More worryingly, native Firefox can only decompress files up to 8 MB in size, otherwise it fails with:

    TypeError: zstd decompression error: Frame requires too much memory for decoding

    This is fine for decoding HTTP responses but in a web app, we'll want to decode files 200 MB in size or larger, so we're stuck with bundling the WASM library anyway (which can decompress up to 2 GB). Given it has identical performance, there's not much point in using new DecompressionStream("zstd") until the 8 MB restriction is lifted, except to maybe keep the processing out of the main thread for < 8 MB files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions