-
-
Notifications
You must be signed in to change notification settings - Fork 38
Description
Is your feature request related to a problem? Please describe.
Maybe this is overkill, but on my system Archey typically runs in around 300-350ms. Some profiling reveals that quite a lot of this is waiting on I/O from commands, files, or internet requests.
I wondered whether multithreading would help make some good use of this CPU wait time, and it does! I pushed a commit to ingrinder/archey4/optimisation implementing multithreading with the builtin concurrent.futures
library, and I get runtimes of around 130-150ms (<100ms with WAN_IP disabled). Since I have archey in my .bashrc
this is quite a noticeable difference 😃
Additional context
Things to consider:
- 👍 Quicker execution time!
- 👍 Spawning threads is lightweight compared to processes.
- 👍 Due to our new
Output
format we get to keep the same order-of-entries even if they are instantiated asynchronously(-ish). - 👎 Profiling is now less accurate since we end up just profiling the thread pool.
- 👎 It's possible Python doesn't support multithreading on all platforms? For example, I know multiprocessing isn't supported on Android, but multithreading appears to be. Not sure where I can find more info on this? Surely most platforms implement threads... right?!
Perhaps given the above downsides, it could be a configurable option? This may give the benefit of compatibility and speed 🚀. Let me know what you think about this anyway.
Metadata
Metadata
Assignees
Labels
Projects
Status