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

Issue #1183: implement ppid_map for Linux #1184

Closed
wants to merge 1 commit into from

Conversation

pitrou
Copy link
Contributor

@pitrou pitrou commented Nov 30, 2017

This makes Process.children() 3x faster when there are no children.

This makes Process.children() 3x faster when there are no children.
@pitrou
Copy link
Contributor Author

pitrou commented Nov 30, 2017

Note that Process.children(recursive=True) doesn't really benefit as it still creates a Process instance for every process on the system.

@pitrou
Copy link
Contributor Author

pitrou commented Nov 30, 2017

@giampaolo

@pitrou
Copy link
Contributor Author

pitrou commented Nov 30, 2017

I've got a patch to also make children(recursive=True) faster. Should I push it in this PR or create a separate PR for it?

@giampaolo
Copy link
Owner

That won't work as it's Linux only. The change is much simpler: just define a _ppid_map() utility function in __init__.py which relies on the per-module Process class directly. That way all platforms can benefit from the speedup.

@pitrou
Copy link
Contributor Author

pitrou commented Nov 30, 2017

The change is much simpler: just define a _ppid_map() utility function in init.py which relies on the per-module Process class directly.

Not sure what you mean by that? The point here is to avoid Process instantiations when we're only interested in a couple of them at the end.

@giampaolo
Copy link
Owner

Instantiating "private" (e.g. look into _pslinux.py) Process classes should be cheap as they define __slots__ (contrarily from the Process class in __init__).

@giampaolo
Copy link
Owner

#1185

@giampaolo
Copy link
Owner

Super seeded by #1185.

@giampaolo giampaolo closed this Dec 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants