GithubHelp home page GithubHelp logo

Configurable averageBits about chunker HOT 3 CLOSED

restic avatar restic commented on August 18, 2024
Configurable averageBits

from chunker.

Comments (3)

fd0 avatar fd0 commented on August 18, 2024

You're welcome. At the time I wrote the package, making averageBits a constant led to much faster code, and since it isn't necessary for restic to configure this, it was left as a constant.

I would consider a PR which adds configuration options for this, if it happens in a backwards compatible way and is not significantly slower than the old code with Go >= 1.8.

What do you plan to do with the chunker?

from chunker.

vitalyisaev2 avatar vitalyisaev2 commented on August 18, 2024

I would consider a PR which adds configuration options for this, if it happens in a backwards compatible way

I guess that the only option to extend library interface is to add an extra constructor for Chunker, something like:

func NewWithCustomAverageBits(rd io.Reader, pol Pol, int averageBits) *Chunker {
    // ...
}

Also, averageBits should become either a global scope variable, or a chunkerConfig member.

and is not significantly slower than the old code with Go >= 1.8

Do you mean that changing averageBits from constant to variable would reduce chunker performance?

What do you plan to do with the chunker?

I'm doing some research on a storage optimizations (especially on data deduplication), and I faced with a use-case where averageBits should be slightly reduced in order to achive better deduplication. A good example is a stream of small text files with little pairwise differences.

from chunker.

fd0 avatar fd0 commented on August 18, 2024

I guess that the only option to extend library interface is to add an extra constructor for Chunker, something like:

What about adding a method on the *Chunker, like SetAverageBits(bits int)?

Also, averageBits should become either a global scope variable, or a chunkerConfig member.

Nonono, no global variable, it must be specific to a single *Chunker. Global state is bad.

Do you mean that changing averageBits from constant to variable would reduce chunker performance?

Exactly, at least for old versions of Go (like 1.3 or so).

I'm doing some research on a storage optimizations (especially on data deduplication), and I faced with a use-case where averageBits should be slightly reduced in order to achive better deduplication. A good example is a stream of small text files with little pairwise differences.

Ah, that makes sense. Thanks for explaining!

from chunker.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.