Python Forum
How can i make this code to run faster
Thread Rating:
  • 1 Vote(s) - 2 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How can i make this code to run faster
#2
Multithreading/multiprocessing. But in order to easily do that, I'd suggest starting with reorganizing your code so it populates and consumes queue.Queues.

For example, start by removing all references to the global variable final_data. Try introducing queue.Queue to store the url/local path pairs, as well as whatever readfile() returns (it isn't currently obvious what an mj or lists is). A new function, who's only job is to process urls, can then be used to spawn multiple threads to handle them in parallel.
Reply


Messages In This Thread
RE: How can i make this code to run faster - by nilamo - Dec-19-2018, 10:59 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [PyCharm] Any Features To Make Programming Easier / Faster? digitalmatic7 3 3,369 Jan-19-2018, 05:55 PM
Last Post: metulburr
  How to make my code work with asyncio? DevinGP 0 2,764 Jan-09-2018, 06:21 PM
Last Post: DevinGP

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020