◐ Shell
clean mode source ↗

Message 129884 - Python tracker

Here is a quick profile under 3.x:

Time: 10178.0 ms
         320812 function calls (320809 primitive calls) in 10.182 seconds

   Ordered by: internal time

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
    10000    5.937    0.001    5.937    0.001 {built-in method read}
    10000    1.462    0.000    1.462    0.000 {built-in method waitpid}
    10000    1.042    0.000    1.042    0.000 {built-in method fork_exec}
    10000    0.752    0.000    8.131    0.001 subprocess.py:1119(_execute_child)
        1    0.228    0.228   10.182   10.182 bench_subprocess.py:1(<module>)
    10000    0.177    0.000    8.345    0.001 subprocess.py:631(__init__)
    20000    0.079    0.000    0.079    0.000 {built-in method close}
    10000    0.061    0.000    1.584    0.000 subprocess.py:1368(wait)


So it looks like our parent Python process spends its time (read(), waitpid()) waiting for its child...