gh-156060: Do not scan every process four times in remote_debugging.get_child_pids() on macOS - #156061
Conversation
|
Great catch! |
|
Thanks @maurycy for the PR, and @pablogsal for merging it 🌮🎉.. I'm working now to backport this PR to: 3.15. |
|
GH-156069 is a backport of this pull request to the 3.15 branch. |
|
|
|
|
|
Closes #156060
Please see #156060 for more details.
Basically,
proc_listpids()returns the number of bytes, not the number of PIDs.This reduces the number of reads:
I don't think it's newsworthy, and I'm not sure how to provide a test for this.
Perhaps a better approach would be just
sysctl(KERN_PROC, KERN_PROC_ALL). I believe it's also available since forever._remote_debugging:get_child_pids()iterates all processes four times #156060