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

bug: unnecessary memcopies in rabin chunker #35

@mikeal

Description

@mikeal

I was looking through the rabin usage and I think I found a bug. I commented more thoroughly in the commit introducing it 542b3e4#r34327138

At least one of 2 things are a bug, depending on how getFingerprints works.

  • If getFingerprints always goes through the end of each chunk it is handed, then there’s an unnecessary copy in Buffer.concat(pending) because pending is cleared on every iteration. This would also mean that the chunking from the stream impacts the fingerprinting and we may want the option of buffering all the data to fingerprint at once.
  • If getFingerprints does not always give you fingerprints through the end of the chunk then this code is dropping tail data when it fingerprints and then sliceing the wrong data out of the bl instance it’s using to keep prior tail data.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions