# rapid-crc

> [![Build Status](https://travis-ci.org/dolegi/rapid-crc.svg?branch=master)](https://travis-ci.org/dolegi/rapid-crc) # Rapid CRC The fastest crc32 and crc32c implemenations on npm

Latest version **1.0.10** (published 2019-08-13) · MIT license · 0 weekly downloads

## Install

```sh
npm install rapid-crc
pnpm add rapid-crc
yarn add rapid-crc
bun add rapid-crc
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.10 |
| Published | 2019-08-13 |
| First published | 2019-08-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 12.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| GitHub stars | 3 |
| Author | dolegi |
| Maintainers | dominicginger |
| Keywords | crc, crc32, crc32c |

## Links

- npm: https://www.npmjs.com/package/rapid-crc
- Repository: https://github.com/dolegi/rapid-crc
- Homepage: https://github.com/dolegi/rapid-crc#readme
- Issues: https://github.com/dolegi/rapid-crc/issues
- npm.io page: https://npm.io/package/rapid-crc

## Dependencies (1)

- [node-addon-api](https://npm.io/package/node-addon-api.md) ^1.7.1

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 1.0.10 (latest) — 2019-08-13
- 1.0.9 — 2019-08-13
- 1.0.8 — 2019-08-12
- 1.0.7 — 2019-08-12
- 1.0.6 — 2019-08-12
- 1.0.5 — 2019-08-12
- 1.0.4 — 2019-08-12
- 1.0.3 — 2019-08-12
- 1.0.2 — 2019-08-12
- 1.0.1 — 2019-08-12
- 1.0.0 — 2019-08-12

## README

[![Build Status](https://travis-ci.org/dolegi/rapid-crc.svg?branch=master)](https://travis-ci.org/dolegi/rapid-crc)
# Rapid CRC
The fastest crc32 and crc32c implemenations on npm

### Install
```bash
npm install rapid-crc
```

### Usage
```javascript
const rapidCrc = require('rapid-crc')

const crc1 = rapidCrc.crc32(Buffer.from('123'))
// -> 2297840959
const crc2 = rapidCrc.crc32c(Buffer.from('123'))
// -> 2413851447
```

### Details

### crc32 
Uses slice-by-32 (based on slice-by-8 by intel and slice-by-16 by stehpan brumme). Increasing the size of the lookup to 32 gave the best performance on my machine (2015 macbook pro, i5, 8GB), by 64 > was slower. I think this is due to the amount of data being loaded per cache-line.

#### crc32c (Castagnoli)
Uses [SSE4.2](https://en.wikipedia.org/wiki/SSE4#SSE4.2).

### Performance
#### crc32
```bash
$ node --version
v10.16.1
$ node performance/benchmark-crc32.js
rapid-crc x 1,593,095 ops/sec ±0.86% (89 runs sampled)
turbo x 608,301 ops/sec ±2.11% (86 runs sampled)
sheetjs x 283,236 ops/sec ±0.92% (90 runs sampled)
Fastest is rapid-crc
```

#### crc32c
```bash
$ node --version
v10.16.1
$ node performance/benchmark-crc32c.js
rapid-crc x 2,677,754 ops/sec ±0.53% (89 runs sampled)
turbo x 617,280 ops/sec ±0.45% (86 runs sampled)
sse4_crc32 x 2,353,431 ops/sec ±0.57% (90 runs sampled)
Fastest is rapid-crc
```

### References
- https://github.com/madler/zlib/blob/master/crc32.c
- https://create.stephan-brumme.com/crc32/
- https://www.npmjs.com/package/sse4_crc32

---
_Source: https://npm.io/package/rapid-crc · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
