Multiprocessing or Multithreading

Asked

Viewed 118 times

0

Good people, recommend what to optimize code? multiprocessing or multithreading? the script is running in series, but has several for in series.

Complete code: https://pastebin.com/WtD6XbVT

  • What does code do? What’s the problem with optimizing it? Where’s the "bottleneck"?

1 answer

0


First time I will give a hint on this kind of subject. Based on this lecture of this year’s pycon, it seems to me that your problem is more suitable for handling and checking str. As it is an activity that requires more processing than I/O waiting (apart from the BD-related part), multiprocessing makes more sense.

But as I read the code very fast, it may be that the data extraction (SQL pulls based on heavy views, or something similar) is the one that consumes the most time, which would indicate multithreading but it doesn’t seem the case.

PS: can the code get more pythonic and Lean saw, but you didn’t ask about it ^_^.

  • Good, first of all thank you and second I didn’t realize what I meant by "can the code get more pythonico and Lean saw".

Browser other questions tagged

You are not signed in. Login or sign up in order to post.