GithubHelp home page GithubHelp logo

Bulk request fetching about pacote HOT 4 CLOSED

zkat avatar zkat commented on May 26, 2024
Bulk request fetching

from pacote.

Comments (4)

boutell avatar boutell commented on May 26, 2024

Bulk stuff as in... big buffer sizes passed to .read()? Just curious what this is about.

(Is it possible to tell a stream to use a bigger buffer size to reduce redundant code?)

from pacote.

zkat avatar zkat commented on May 26, 2024

@boutell it depends! fs.{read,write}File() are significantly faster than fs.create{Read,Write}Stream(). On the order of ~3x speedup for the former. And that's the case even when you bump things up such that it's a single _write. There's benchmarks over at cacache that test reads and writes both in streaming and bulk mode, too, and cacache itself is already 3-4x faster when doing bulk operations on both read and write. (just clone the repo, do npm i && npm run benchmarks)

The story with network requests is a little different. Probably because of all the stuff npm-registry-client is doing for restarting and parsing bulk requests, streaming: true is ~2x+ faster (more? I had a benchmark somewhere).

So pacote would need to make judicious use of both streams and bulk writes, depending on the data size (which fortunately we usually have, because of Content-Length).

I already have a benchmark suite branch that I need to nudge a little more before it's ready to merge, but that's gonna be super important in finding the right combination for all this :)

from pacote.

zkat avatar zkat commented on May 26, 2024

Maybe I'll just push it up cause it might start being useful to folks who are interested in doing this sort of optimization golf 😁

from pacote.

zkat avatar zkat commented on May 26, 2024

#61 There we go. This should help.

from pacote.

Related Issues (20)

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.