-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Linux] process_iter ridiculously slow (like 240x slow than ps) #1751
Comments
oh, and I tried selecting fields... it made no difference. |
the following is also an order of magnitude faster:
It looks like psutil gathers many data structures that the user is not asking for, and it is very |
You're using it wrong. It should be: import psutil
for proc in psutil.process_iter( ['pid','cmdline','name', 'username' ] ):
- p = proc.as_dict()
+ proc.info |
Thanks! |
@giampaolo I already had it like that in my case on windows and its still super slow, getting 6 attributes takes about 12 seconds for 180 processes. Any other ideas? The slowness is in the psutil.process_iter step. Im curious how other tools like Process hacker can handle many fields and thousands of processes super fast, |
Platform
Bug description
python psutil.process_iter runs 240 times slow than ps.
it's not usable.
The text was updated successfully, but these errors were encountered: