Skip to content
This repository has been archived by the owner on Apr 29, 2020. It is now read-only.

perf: avoid unnecessary buffer copy #40

Merged
merged 1 commit into from
Nov 27, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions src/chunker/rabin.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,11 @@ const jsRabin = () => {
return async function * (source, options) {
const r = await create(options.bits, options.min, options.max, options.window)
const buffers = new BufferList()
let pending = []

for await (const chunk of source) {
buffers.append(chunk)
pending.push(chunk)

const sizes = r.fingerprint(Buffer.concat(pending))
pending = []
const sizes = r.fingerprint(chunk)

for (let i = 0; i < sizes.length; i++) {
var size = sizes[i]
Expand Down