GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — zlib: add crc32c by pipobscure · Pull Request #66828 · nodejs/node

Conversation

@pipobscure

@pipobscure pipobscure commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Add zlib.crc32c(data[, value]), which computes the CRC-32C checksum (Castagnoli polynomial, RFC 3720 section 12.1). CRC-32C has better error detection properties than the CRC-32 of zlib.crc32() and is the checksum required by many current protocols, formats and services, among them:

  • iSCSI header and data digests (RFC 7143)
  • SCTP packet checksums (RFC 9260)
  • iWARP MPA framing (RFC 5044)
  • NVMe/TCP header and data digests
  • ext4, Btrfs and XFS metadata checksums
  • the Snappy framing format
  • Apache Kafka record batches
  • LevelDB and RocksDB block checksums
  • TensorFlow TFRecord files
  • Google Cloud Storage and Amazon S3 object checksums

Implementing any of these in JavaScript currently needs a userland CRC-32C, which is far slower than native code.

The function mirrors zlib.crc32(): it accepts a string (encoded as UTF-8) or an ArrayBufferView, takes an optional 32-bit unsigned starting value so a checksum can be continued across chunks, and has a V8 fast API path.

The checksum is computed by absl::ExtendCrc32c() from the bundled Abseil, which is already built and linked into node, so this adds no new dependency and no new checksum implementation. absl_crc32c is added to the libraries linked with --shared-abseil.

Abseil selects its hardware-accelerated CRC-32C path (SSE4.2 and PCLMULQDQ on x64, the CRC32 and PMULL extensions on arm64) at compile time, so with node's default compiler flags the portable table-driven implementation is used. It runs at about the same speed as zlib.crc32() (about 6.5 GB/s on a recent x64 machine), while the hardware path reaches about 38 GB/s. Builds whose target CPU baseline already includes those instructions get the hardware path without changes. Enabling it for generic builds is left out on purpose: on x64, Abseil uses the accelerated code for unrecognized CPUs without a runtime feature check, so compiling it in unconditionally would fault on CPUs without SSE4.2.

I had agentic help here, but I did review and check every single line.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@pipobscure
zlib: add crc32c
fbeb1b3
Add zlib.crc32c(data[, value]), which computes the CRC-32C checksum
(Castagnoli polynomial, RFC 3720 section 12.1). CRC-32C has better
error detection properties than the CRC-32 of zlib.crc32() and is the
checksum required by many current protocols, formats and services,
among them:

- iSCSI header and data digests (RFC 7143)
- SCTP packet checksums (RFC 9260)
- iWARP MPA framing (RFC 5044)
- NVMe/TCP header and data digests
- ext4, Btrfs and XFS metadata checksums
- the Snappy framing format
- Apache Kafka record batches
- LevelDB and RocksDB block checksums
- TensorFlow TFRecord files
- Google Cloud Storage and Amazon S3 object checksums

Implementing any of these in JavaScript currently needs a userland
CRC-32C, which is far slower than native code.

The function mirrors zlib.crc32(): it accepts a string (encoded as
UTF-8) or an ArrayBufferView, takes an optional 32-bit unsigned
starting value so a checksum can be continued across chunks, and has a
V8 fast API path.

The checksum is computed by absl::ExtendCrc32c() from the bundled
Abseil, which is already built and linked into node, so this adds no
new dependency and no new checksum implementation. absl_crc32c is
added to the libraries linked with --shared-abseil.

Abseil selects its hardware-accelerated CRC-32C path (SSE4.2 and
PCLMULQDQ on x64, the CRC32 and PMULL extensions on arm64) at compile
time, so with node's default compiler flags the portable table-driven
implementation is used. It runs at about the same speed as zlib.crc32()
(about 6.5 GB/s on a recent x64 machine), while the hardware path
reaches about 38 GB/s. Builds whose target CPU baseline already
includes those instructions get the hardware path without changes.
Enabling it for generic builds is left out on purpose: on x64, Abseil
uses the accelerated code for unrecognized CPUs without a runtime
feature check, so compiling it in unconditionally would fault on CPUs
without SSE4.2.

Signed-off-by: Philipp Dunkel <[email protected]>
@nodejs-github-bot

nodejs-github-bot commented Oct 18, 2026

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/performance
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs involving general changes in the lib/ or src/ directories. needs-ci PRs that need a full CI run. labels Oct 18, 2026
@codecov

codecov Bot commented Oct 18, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.62500% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.49%. Comparing base (f513ec7) to head (fbeb1b3).
⚠️ Report is 27 commits behind head on main.

Files with missing lines Patch % Lines
src/node_zlib.cc 85.00% 0 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #66828      +/-   ##
==========================================
- Coverage   90.49%   90.49%   -0.01%     
==========================================
  Files         797      797              
  Lines      277686   277824     +138     
  Branches    53362    53376      +14     
==========================================
+ Hits       251292   251413     +121     
+ Misses      16796    16795       -1     
- Partials     9598     9616      +18     
Files with missing lines Coverage Δ
lib/zlib.js 98.14% <100.00%> (+0.01%) ⬆️
src/node_zlib.cc 80.28% <85.00%> (+0.07%) ⬆️

... and 38 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@pipobscure

pipobscure commented Oct 19, 2026

Copy link
Copy Markdown
Contributor Author

Can I get a review and CI on this please (@jasnell @panva @mcollina @aduh95 @trivikr or anyone)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

mcollina
mcollina approved these changes Oct 19, 2026
View reviewed changes

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

lgtm

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@richardlau richardlau added semver-minor PRs that contain new features and should be released in the next minor version. request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. labels Oct 19, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Oct 19, 2026
@nodejs-github-bot

This comment was marked as outdated.

Sign in to view
ShogunPanda
ShogunPanda approved these changes Oct 19, 2026
View reviewed changes
trivikr
trivikr approved these changes Oct 19, 2026
View reviewed changes
@trivikr trivikr added the resume-ci Add this label to resume the latest eligible Jenkins CI run on a PR with an approving review. label Oct 19, 2026
@github-actions github-actions Bot removed the resume-ci Add this label to resume the latest eligible Jenkins CI run on a PR with an approving review. label Oct 19, 2026
@nodejs-github-bot

nodejs-github-bot commented Oct 19, 2026

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/78488/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@pipobscure

pipobscure commented Oct 19, 2026

Copy link
Copy Markdown
Contributor Author

Awesome. CI passes. This is as ready as I can get it.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@trivikr trivikr added commit-queue PRs queued for automated landing through the Commit Queue. author ready PRs with CI started, the required approvals, and no outstanding review comments. labels Oct 19, 2026
@nodejs-github-bot
nodejs-github-bot merged commit df2ea49 into nodejs:main Oct 20, 2026
96 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot

nodejs-github-bot commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator

Landed in df2ea49

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot nodejs-github-bot removed the commit-queue PRs queued for automated landing through the Commit Queue. label Oct 20, 2026
@trivikr trivikr mentioned this pull request Oct 25, 2026
benchmark: merge crc32c into crc32 zlib benchmark #67004
Merged
@aduh95 aduh95 mentioned this pull request Oct 27, 2026
2026-10-28, Version 27.0.0-alpha.0.0.0 (Alpha) #67062
Merged
nodejs-github-bot pushed a commit that referenced this pull request Nov 1, 2026
@trivikr
benchmark: merge crc32c into crc32 zlib benchmark
2758c59
Signed-off-by: Trivikram Kamat <[email protected]>
PR-URL: #67004
Refs: #66828
Reviewed-By: Luigi Pinca <[email protected]>
aduh95 pushed a commit that referenced this pull request Nov 11, 2026
@trivikr @aduh95
benchmark: merge crc32c into crc32 zlib benchmark
cdef4ac
Signed-off-by: Trivikram Kamat <[email protected]>
PR-URL: #67004
Refs: #66828
Reviewed-By: Luigi Pinca <[email protected]>
aduh95 pushed a commit that referenced this pull request Nov 12, 2026
@pipobscure @aduh95
zlib: add crc32c
36b1de5
Add zlib.crc32c(data[, value]), which computes the CRC-32C checksum
(Castagnoli polynomial, RFC 3720 section 12.1). CRC-32C has better
error detection properties than the CRC-32 of zlib.crc32() and is the
checksum required by many current protocols, formats and services,
among them:

- iSCSI header and data digests (RFC 7143)
- SCTP packet checksums (RFC 9260)
- iWARP MPA framing (RFC 5044)
- NVMe/TCP header and data digests
- ext4, Btrfs and XFS metadata checksums
- the Snappy framing format
- Apache Kafka record batches
- LevelDB and RocksDB block checksums
- TensorFlow TFRecord files
- Google Cloud Storage and Amazon S3 object checksums

Implementing any of these in JavaScript currently needs a userland
CRC-32C, which is far slower than native code.

The function mirrors zlib.crc32(): it accepts a string (encoded as
UTF-8) or an ArrayBufferView, takes an optional 32-bit unsigned
starting value so a checksum can be continued across chunks, and has a
V8 fast API path.

The checksum is computed by absl::ExtendCrc32c() from the bundled
Abseil, which is already built and linked into node, so this adds no
new dependency and no new checksum implementation. absl_crc32c is
added to the libraries linked with --shared-abseil.

Abseil selects its hardware-accelerated CRC-32C path (SSE4.2 and
PCLMULQDQ on x64, the CRC32 and PMULL extensions on arm64) at compile
time, so with node's default compiler flags the portable table-driven
implementation is used. It runs at about the same speed as zlib.crc32()
(about 6.5 GB/s on a recent x64 machine), while the hardware path
reaches about 38 GB/s. Builds whose target CPU baseline already
includes those instructions get the hardware path without changes.
Enabling it for generic builds is left out on purpose: on x64, Abseil
uses the accelerated code for unrecognized CPUs without a runtime
feature check, so compiling it in unconditionally would fault on CPUs
without SSE4.2.

Signed-off-by: Philipp Dunkel <[email protected]>
PR-URL: #66828
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Paolo Insogna <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
aduh95 pushed a commit that referenced this pull request Nov 12, 2026
@trivikr @aduh95
benchmark: merge crc32c into crc32 zlib benchmark
6f3282b
Signed-off-by: Trivikram Kamat <[email protected]>
PR-URL: #67004
Refs: #66828
Reviewed-By: Luigi Pinca <[email protected]>
@github-actions github-actions Bot mentioned this pull request Nov 20, 2026
2026-11-30, Version 26.14.0 'Lithium' (LTS) #67664
Open
nodejs-github-bot added a commit that referenced this pull request Nov 20, 2026
@nodejs-github-bot
2026-11-30, Version 26.14.0 'Lithium' (LTS)
7692ae4
Notable changes:

child_process:
  * (SEMVER-MINOR) add subprocess.timedOut (Marco) #66639
doc:
  * add efekrskl to collaborators (Efe Karasakal) #67376
  * add Philipp Dunkel to contributors (Philipp Dunkel) #67378
  * add christianaurichzm to collaborators (Christian Aurich Zanettini Martins) #67377
fs:
  * (SEMVER-MINOR) add mkstemp() (Marco) #66484
http:
  * (SEMVER-MINOR) batch body spans per parser execute (Guilherme Araújo) #67187
lib:
  * (SEMVER-MINOR) speed up AbortSignal (Robert Nagy) #66789
module:
  * (SEMVER-MINOR) add --experimental-strip-private-modules (Marco Ippolito) #63869
process:
  * (SEMVER-MINOR) return unregister fn from finalization (Matteo Collina) #66482
test_runner:
  * use AsyncLocalStorage instead of async_hooks (Matteo Collina) #66795
  * (SEMVER-MINOR) add mockReturnValue and promise helpers (Guilherme Araújo) #66631
worker:
  * (SEMVER-MINOR) preload streams into startup snapshot (Matteo Collina) #66311
zlib:
  * (SEMVER-MINOR) add crc32c (Philipp Dunkel) #66828

PR-URL: #67664
aduh95 added a commit that referenced this pull request Nov 21, 2026
@aduh95
2026-11-30, Version 26.14.0 'Lithium' (LTS)
193c052
Notable changes:

child_process:
  * (SEMVER-MINOR) add subprocess.timedOut (Marco) #66639
doc:
  * add efekrskl to collaborators (Efe Karasakal) #67376
  * add Philipp Dunkel to contributors (Philipp Dunkel) #67378
  * add christianaurichzm to collaborators (Christian Aurich Zanettini Martins) #67377
fs:
  * (SEMVER-MINOR) add mkstemp() (Marco) #66484
http:
  * (SEMVER-MINOR) batch body spans per parser execute (Guilherme Araújo) #67187
lib:
  * (SEMVER-MINOR) speed up AbortSignal (Robert Nagy) #66789
module:
  * (SEMVER-MINOR) add --experimental-strip-private-modules (Marco Ippolito) #63869
process:
  * (SEMVER-MINOR) return unregister fn from finalization (Matteo Collina) #66482
test_runner:
  * use AsyncLocalStorage instead of async_hooks (Matteo Collina) #66795
  * (SEMVER-MINOR) add mockReturnValue and promise helpers (Guilherme Araújo) #66631
worker:
  * (SEMVER-MINOR) preload streams into startup snapshot (Matteo Collina) #66311
zlib:
  * (SEMVER-MINOR) add crc32c (Philipp Dunkel) #66828

PR-URL: #67664
gabylb pushed a commit to gabylb/node that referenced this pull request Nov 27, 2026
@pipobscure @gabylb
zlib: add crc32c
e23a19e
Add zlib.crc32c(data[, value]), which computes the CRC-32C checksum
(Castagnoli polynomial, RFC 3720 section 12.1). CRC-32C has better
error detection properties than the CRC-32 of zlib.crc32() and is the
checksum required by many current protocols, formats and services,
among them:

- iSCSI header and data digests (RFC 7143)
- SCTP packet checksums (RFC 9260)
- iWARP MPA framing (RFC 5044)
- NVMe/TCP header and data digests
- ext4, Btrfs and XFS metadata checksums
- the Snappy framing format
- Apache Kafka record batches
- LevelDB and RocksDB block checksums
- TensorFlow TFRecord files
- Google Cloud Storage and Amazon S3 object checksums

Implementing any of these in JavaScript currently needs a userland
CRC-32C, which is far slower than native code.

The function mirrors zlib.crc32(): it accepts a string (encoded as
UTF-8) or an ArrayBufferView, takes an optional 32-bit unsigned
starting value so a checksum can be continued across chunks, and has a
V8 fast API path.

The checksum is computed by absl::ExtendCrc32c() from the bundled
Abseil, which is already built and linked into node, so this adds no
new dependency and no new checksum implementation. absl_crc32c is
added to the libraries linked with --shared-abseil.

Abseil selects its hardware-accelerated CRC-32C path (SSE4.2 and
PCLMULQDQ on x64, the CRC32 and PMULL extensions on arm64) at compile
time, so with node's default compiler flags the portable table-driven
implementation is used. It runs at about the same speed as zlib.crc32()
(about 6.5 GB/s on a recent x64 machine), while the hardware path
reaches about 38 GB/s. Builds whose target CPU baseline already
includes those instructions get the hardware path without changes.
Enabling it for generic builds is left out on purpose: on x64, Abseil
uses the accelerated code for unrecognized CPUs without a runtime
feature check, so compiling it in unconditionally would fault on CPUs
without SSE4.2.

Signed-off-by: Philipp Dunkel <[email protected]>
PR-URL: nodejs#66828
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Paolo Insogna <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
gabylb pushed a commit to gabylb/node that referenced this pull request Nov 27, 2026
@trivikr @gabylb
benchmark: merge crc32c into crc32 zlib benchmark
ab93e1e
Signed-off-by: Trivikram Kamat <[email protected]>
PR-URL: nodejs#67004
Refs: nodejs#66828
Reviewed-By: Luigi Pinca <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@mcollina mcollina mcollina approved these changes
@ShogunPanda ShogunPanda ShogunPanda approved these changes
@trivikr trivikr trivikr approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs involving general changes in the lib/ or src/ directories. needs-ci PRs that need a full CI run. semver-minor PRs that contain new features and should be released in the next minor version.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

6 participants

@pipobscure @nodejs-github-bot @mcollina @ShogunPanda @trivikr @richardlau
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.