- License
- MIT
- Deps
- 0
- Install Size
- 22.3 kB(592.9 kB)
- Vulns
- 0
- Published
$
npm install @node-rs/xxhash$
pnpm add @node-rs/xxhash$
yarn add @node-rs/xxhash$
bun add @node-rs/xxhash$
deno add npm:@node-rs/xxhash$
vlt install @node-rs/xxhash$
vp add @node-rs/xxhash@node-rs/xxhash
๐ Help me to become a full-time open-source developer by sponsoring me on Github
xxhash-rust binding for Node.js.
Install this package
yarn add @node-rs/xxhash
pnpm add @node-rs/xxhash
npm install @node-rs/xxhash
API
export type BufferLike =
| Buffer
| string
| Uint8Array
| ArrayBuffer
| SharedArrayBuffer
| ReadonlyArray<number>
| number[]
export function xxh32(input: BufferLike, seed?: number): number
export function xxh64(input: BufferLike, seed?: BigInt): BigInt
export class Xxh32 {
constructor(seed?: number)
update(input: BufferLike): this
digest(): number
reset(): void
}
export class Xxh64 {
constructor(seed?: BigInt)
update(input: BufferLike): this
digest(): BigInt
reset(): void
}
export class Xxh3 {
static withSeed(seed?: BigInt): Xxh3
static withSecret(secret: BufferLike): Xxh3
private constructor() {}
update(input: BufferLike): this
digest(): BigInt
reset(): void
}
export const xxh3: {
xxh64: (input: BufferLike, seed?: BigInt) => BigInt
xxh64WithSecret: (input: BufferLike, secret: BufferLike) => BigInt
xxh128: (input: BufferLike, seed?: BigInt) => BigInt
xxh128WithSecret: (input: BufferLike, secret: BufferLike) => BigInt
Xxh3: typeof Xxh3
}
Performance
Hardware
,MMMM. Host - xxxxxxxxxxxxxxxxxxxxxxx
.MMMMMM Machine - Mac15,9
MMMMM, Kernel - 24.0.0
.;MMMMM:' MMMMMMMMMM;. OS - macOS 15.0.1 Sequoia
MMMMMMMMMMMMNWMMMMMMMMMMM: DE - Aqua
.MMMMMMMMMMMMMMMMMMMMMMMMWM. WM - Quartz Compositor
MMMMMMMMMMMMMMMMMMMMMMMMM. Packages - 194 (Homebrew), 32 (cargo)
;MMMMMMMMMMMMMMMMMMMMMMMM: Shell - zsh
:MMMMMMMMMMMMMMMMMMMMMMMM: Terminal - warpterminal (Version v0.2024.10.23.14.49.stable_00)
.MMMMMMMMMMMMMMMMMMMMMMMMM. Resolution - 5120x2880@160fps (as 2560x1440)
MMMMMMMMMMMMMMMMMMMMMMMMMMM. 2992x1934@120fps (as 1496x967)
.MMMMMMMMMMMMMMMMMMMMMMMMMM. 2232x1512@60fps (as 1116x756)
MMMMMMMMMMMMMMMMMMMMMMMM Uptime - 1d 2h 32m
;MMMMMMMMMMMMMMMMMMMM. CPU - Apple M3 Max (16)
.MMMM,. .MMMM,. CPU Load - 16%
Memory - 50.1 GB / 134.2 GB
Battery - 78% & Discharging
Disk Space - 624.0 GB / 994.7 GB
Result
โฏ yarn workspace @node-rs/xxhash bench
xxh32 without initial seed
โโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโฌโโโโโโโโโโ
โ (index) โ Task Name โ ops/sec โ Average Time (ns) โ Margin โ Samples โ
โโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโผโโโโโโโโโโค
โ 0 โ '@node-rs/xxhash h32' โ '20,146' โ 49637.20101250711 โ 'ยฑ0.20%' โ 10074 โ
โ 1 โ 'xxhash c++' โ '17,348' โ 57642.4387319887 โ 'ยฑ0.19%' โ 8675 โ
โ 2 โ 'xxhashjs h32' โ '2,697' โ 370657.902149741 โ 'ยฑ0.24%' โ 1349 โ
โโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโดโโโโโโโโโโ
xxh32 without initial seed multi step
โโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโฌโโโโโโโโโโ
โ (index) โ Task Name โ ops/sec โ Average Time (ns) โ Margin โ Samples โ
โโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโผโโโโโโโโโโค
โ 0 โ '@node-rs/xxhash h32' โ '17,111' โ 58440.61746142987 โ 'ยฑ0.20%' โ 8556 โ
โ 1 โ 'xxhashjs h32' โ '2,738' โ 365160.82262773765 โ 'ยฑ0.19%' โ 1370 โ
โโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโดโโโโโโโโโโ
xxh64 without initial seed
โโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโฌโโโโโโโโโโ
โ (index) โ Task Name โ ops/sec โ Average Time (ns) โ Margin โ Samples โ
โโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโผโโโโโโโโโโค
โ 0 โ '@node-rs/xxhash 64' โ '50,159' โ 19936.33995215147 โ 'ยฑ0.11%' โ 25080 โ
โ 1 โ 'xxhash C++' โ '47,980' โ 20841.790588135264 โ 'ยฑ0.17%' โ 23991 โ
โ 2 โ 'wasm' โ '33,916' โ 29484.03756117805 โ 'ยฑ0.21%' โ 16959 โ
โ 3 โ 'xxhashjs h64' โ '95' โ 10431058.97916674 โ 'ยฑ0.57%' โ 48 โ
โโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโดโโโโโโโโโโ
xxh64 without initial seed multi step
โโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโฌโโโโโโโโโโ
โ (index) โ Task Name โ ops/sec โ Average Time (ns) โ Margin โ Samples โ
โโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโผโโโโโโโโโโค
โ 0 โ '@node-rs/xxhash 64' โ '46,603' โ 21457.79825765685 โ 'ยฑ0.20%' โ 23302 โ
โ 1 โ 'wasm' โ '34,681' โ 28834.205985814675 โ 'ยฑ0.19%' โ 17341 โ
โ 2 โ 'xxhashjs h64' โ '96' โ 10411336.75510195 โ 'ยฑ0.73%' โ 49 โ
โโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโดโโโโโโโโโโ