可以做些什么来使 Python 中的子进程调用更快?

Bo *_*ang 5 python subprocess

我有一个用 C 编写的可执行文件,但没有源代码。我可以在 python 中调用(在 ubuntu linux 中):

from subprocess import Popen, PIPE

# variable 'output' is the string I need.
p = Popen(["./excutable",par1,par2]], stdin=PIPE, stdout=PIPE, stderr=PIPE)
output, err = p.communicate()
rc = p.returncode
Run Code Online (Sandbox Code Playgroud)

这对我来说很好用,除非我需要这样做数百万次。运行需要很多时间。有没有办法运行得更快?

谢谢!