Skip to content

Conversation

@onethumb
Copy link
Contributor

The Problem

It's been requested that we reduce our dependency footprint by removing the crc crate. #32

The Solution

Remove the crc crate.

Changes

  • Generates tables for table-based software lookups
  • Uses generated tables for checksum calculations on non-hardware accelerated platforms
  • Removes crc and crc-catalog from the non-dev dependency tree
  • Continues to use crc for testing to ensure correct calculations

Planned version bump

  • Which: PATCH
  • Why: non-breaking internal change

Links

Notes

Dependency tree is getting pretty light now, we should be careful about adding any new non-dev dependencies:

crc-fast 
├── digest v0.10.7
│   └── crypto-common v0.1.7
│       ├── generic-array v0.14.7
│       │   └── typenum v1.19.0
│       │   [build-dependencies]
│       │   └── version_check v0.9.5
│       └── typenum v1.19.0
└── spin v0.10.0

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR successfully removes the crc crate from runtime dependencies while maintaining it as a dev dependency for testing. The change reduces the dependency footprint by implementing native table-based CRC calculations.

Key changes:

  • Implements native 16-lane lookup table generation for CRC-16, CRC-32, and CRC-64 algorithms
  • Adds an Algorithm<W> struct to define CRC parameters internally, replacing the dependency on the crc crate's version
  • Creates a binary utility (generate-tables) to pre-compute lookup tables
  • Moves crc dependency to dev-dependencies for continued testing against reference implementation

Reviewed changes

Copilot reviewed 12 out of 15 changed files in this pull request and generated no comments.

Show a summary per file
File Description
Cargo.toml Moves crc from dependencies to dev-dependencies; adds generate-tables binary
Cargo.lock Updates indirect dependency versions (cc, find-msvc-tools, zmij)
src/structs.rs Adds new Algorithm<W> struct to replace external crc::Algorithm
src/lib.rs Changes arch module visibility to public; adds tables module; updates checksum_with_params to use init_algorithm
src/consts.rs Removes imported crc::Algorithm and previously defined CRC algorithm constants
src/crc16/consts.rs Adds 31 Algorithm<u16> constants for all CRC-16 variants
src/crc32/consts.rs Adds 12 Algorithm<u32> constants for all CRC-32 variants
src/crc64/consts.rs Adds 7 Algorithm<u64> constants for all CRC-64 variants
src/bin/generate-tables.rs New binary utility to generate pre-computed lookup tables
src/arch/software.rs Implements native table generation and CRC update functions; adds comprehensive property tests
src/arch/x86_64/avx512_vpclmulqdq.rs Adds Default trait implementation
src/arch/x86_64/avx512.rs Adds Default trait implementation
src/arch/aarch64/aes_sha3.rs Adds Default trait implementation
src/test/consts.rs Adds CRC_64_NVME_CRC constant for testing; updates RUST_CRC64_NVME to use new constant

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@onethumb onethumb merged commit d0fcf2a into awesomized:main Dec 26, 2025
106 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant