Giter Site home page Giter Site logo

Make receipts command faster about jarbas HOT 5 CLOSED

cuducos avatar cuducos commented on August 22, 2024
Make receipts command faster

from jarbas.

Comments (5)

gwmoura avatar gwmoura commented on August 22, 2024

@cuducos sorry, I am don't know much about this area, but searching by this subject I found this package: multiprocessing - https://docs.python.org/3/library/multiprocessing.html

effectively side-stepping the Global Interpreter Lock by using subprocesses instead of threads.

Probabilly you know about this...

I found too this tutorial and I think he can help us - https://www.toptal.com/python/beginners-guide-to-concurrency-and-parallelism-in-python

from jarbas.

cuducos avatar cuducos commented on August 22, 2024

Yep, I used this on #66 — it works fine but I couldn't write tests for it (I mean, the tests I wrote were not working), so still on hold…

from jarbas.

cuducos avatar cuducos commented on August 22, 2024

Anyway… further thoughts: in the case of receipts, asyncio seems more promising than multiprocessing alone due to long time waiting for the response os a request (not long time waiting for processing). The trick is to start multiple HTTP requests ar once, not necessarily to distribute them among processes/threads ; )

from jarbas.

gwmoura avatar gwmoura commented on August 22, 2024

So, we can start multiple HTTP requests using multiprocessing or threads and use asyncio to create an asynchronous HTTP consumer or asyncio solves the all problems?

from jarbas.

cuducos avatar cuducos commented on August 22, 2024

Actually I think that asyncio would be better to make parallel requests: a coroutine that starts the next request while waits for the current one's response, and so on… this way we can have a lot of requests started in the latency in-between sending a request and getting its response. Later we can start different process like that, but we have to test and see the results first IMHO…

from jarbas.

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.