Skip to content

doc: add missing Zstd strategy constants #59312

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 19, 2025

Conversation

Annaick
Copy link
Contributor

@Annaick Annaick commented Aug 1, 2025

Documents the ZSTD_c_strategy parameter and its possible values (ZSTD_fast … ZSTD_btultra2) that were already exposed in zlib.constants but missing from the API docs and added an example for reference.

Fixes: #59290

@nodejs-github-bot nodejs-github-bot added doc Issues and PRs related to the documentations. zlib Issues and PRs related to the zlib subsystem. labels Aug 1, 2025
@jasnell jasnell added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. commit-queue Add this label to land a pull request using GitHub Actions. labels Aug 1, 2025
doc/api/zlib.md Outdated
@@ -750,6 +750,34 @@ The most important options are:
* `ZSTD_c_compressionLevel`
* Set compression parameters according to pre-defined cLevel table. Default
level is ZSTD\_CLEVEL\_DEFAULT==3.
* `ZSTD_c_strategy`
* Select the compression strategy. Default is `ZSTD_lazy2`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am just curious to know from where is coming this default strategy.

I have found this: https://github.com/nodejs/node/blob/main/deps/zstd/lib/zstd.h#L355-L364

The compression level (default: 3) dynamically determines compression parameters, including the strategy, unless ZSTD_c_strategy is explicitly set. This implies that the default strategy is tied to the default compression level (ZSTD_CLEVEL_DEFAULT == 3), which typically maps to ZSTD_greedy

Copy link
Contributor

@bricss bricss Aug 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what internet 📡 saying:

When using the zstd command, you can specify different compression levels, and zstd automatically selects a strategy based on the level. Levels 1 and 2 use faster strategies, while level 3 and above default to ZSTD_greedy.

But I cannot find any source nor doc to prove it 🤷

Copy link
Contributor

@bricss bricss Aug 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nodejs-github-bot nodejs-github-bot added commit-queue-failed An error occurred while landing this pull request using GitHub Actions. and removed commit-queue Add this label to land a pull request using GitHub Actions. labels Aug 3, 2025
@nodejs-github-bot
Copy link
Collaborator

Commit Queue failed
- Loading data for nodejs/node/pull/59312
✔  Done loading data for nodejs/node/pull/59312
----------------------------------- PR info ------------------------------------
Title      doc: add missing Zstd strategy constants (#59312)
Author     RANDRIAMANANTENA Narindra Tiana Annaick <[email protected]> (@Annaick, first-time contributor)
Branch     Annaick:doc-zstd-strategy-constants -> nodejs:main
Labels     doc, zlib, author ready
Commits    2
 - doc: add missing Zstd strategy constants
 - doc: omited default strategy for zstd_c_strategy
Committers 1
 - annaick <[email protected]>
PR-URL: https://github.com/nodejs/node/pull/59312
Fixes: https://github.com/nodejs/node/issues/59290
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/59312
Fixes: https://github.com/nodejs/node/issues/59290
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
--------------------------------------------------------------------------------
   ⚠  Commits were pushed since the last approving review:
   ⚠  - doc: add missing Zstd strategy constants
   ⚠  - doc: omited default strategy for zstd_c_strategy
   ℹ  This PR was created on Fri, 01 Aug 2025 10:27:31 GMT
   ✔  Approvals: 2
   ✔  - James M Snell (@jasnell) (TSC): https://github.com/nodejs/node/pull/59312#pullrequestreview-3079463740
   ✔  - Luigi Pinca (@lpinca): https://github.com/nodejs/node/pull/59312#pullrequestreview-3079898823
   ✘  Last GitHub CI failed
   ℹ  Green GitHub CI is sufficient
--------------------------------------------------------------------------------
   ✔  Aborted `git node land` session in /home/runner/work/node/node/.ncu
https://github.com/nodejs/node/actions/runs/16704072824

@bricss
Copy link
Contributor

bricss commented Aug 5, 2025

Hope, it can land 🛬 already ⌛

@jakecastelli
Copy link
Member

CQ failed due to the latest commit pushed from the author didn't go through GHA, I have kicked started the GHA run, once its ready it will need another approval and then it can land.

@aduh95 aduh95 added commit-queue Add this label to land a pull request using GitHub Actions. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. and removed commit-queue-failed An error occurred while landing this pull request using GitHub Actions. labels Aug 19, 2025
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Aug 19, 2025
@nodejs-github-bot nodejs-github-bot merged commit ef58be6 into nodejs:main Aug 19, 2025
26 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in ef58be6

targos pushed a commit that referenced this pull request Aug 21, 2025
PR-URL: #59312
Fixes: #59290
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. doc Issues and PRs related to the documentations. zlib Issues and PRs related to the zlib subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expand documentation for Zstd strategy parameter (ZSTD_c_strategy) and constants in node:zlib
8 participants