Skip to content

possible Zstandard decompression improvements #14702

@dweiller

Description

@dweiller

There are a few things that were explicitly not done in the initial Zstandard decompression PR that may be desired improvements. This issue is to collect them (and others that pop up in between) for future reference in a pre-1.0 stdlib review or to list them incase someone to tackle them earlier.

  • The current implementation does not decode 4-stream literal sections in parallel in order to avoid memory allocations (or remove a need for an additional 128KiB of memory) in the non-allocating API. This presumably sacrifices decompression performance, but benchmarking may be needed to assess what the impact is in practice. This change would require re-working the block decoding in lib/std/compress/zstandard/decode/block.zig to eagerly decode literals into an extra internal buffer.
  • Reuse allocations between frames in std.compress.zstd.decompress.decodeAlloc() API). The frame window could be re-used between frames (provided it is large enough). The relevant allocation is here.
  • a few issue we found may result in minor updates to the zstandard spec - issues found while fuzzing to compare behaviour of Zig decoder to this repo facebook/zstd#3508 is the main upstream issue that will hopefully link to any related changes that get made.

Metadata

Metadata

Assignees

No one assigned

    Labels

    contributor friendlyThis issue is limited in scope and/or knowledge of Zig internals.enhancementSolving this issue will likely involve adding new logic or components to the codebase.standard libraryThis issue involves writing Zig code for the standard library.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions