Skip to content
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

Speedup process iter #2404

Merged
merged 8 commits into from
Apr 17, 2024
Merged

Speedup process iter #2404

merged 8 commits into from
Apr 17, 2024

Conversation

giampaolo
Copy link
Owner

Summary

  • OS: all
  • Bug fix: no
  • Type: performance, new-api
  • Fixes: 2396

Description

No longer make process_iter() check whether PID has been reused. This makes it around 20x times faster on Linux. Also changed Process.is_running() so that it will automatically remove the reused PID from process_iter() internal cache. In addition, also add a new process_iter.cache_clear() API.

@giampaolo giampaolo merged commit 7556e5d into master Apr 17, 2024
24 of 28 checks passed
@giampaolo giampaolo deleted the speedup-process-iter branch April 17, 2024 15:01
ddelange added a commit to ddelange/psutil that referenced this pull request May 16, 2024
* 'master' of https://github.com/giampaolo/psutil:
  fix ruff errs
  skip flaky test on netbsd
  giampaolo#2408: fix some tests which were still failing due to the old name
  giampaolo#2408: ignore old "connections" name into as_dict()
  Rename `Process.connections()` to `Process.net_connections()` (giampaolo#2408)
  Remove disk_partitions() `maxfile` and `maxpath` fields (giampaolo#2405)
  Speedup process iter (don't check for PID reuse) (giampaolo#2404)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant