How to speed up communication with subprocesses

后端 未结 5 856
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-02 02:11

I am using Python 2 subprocess with threading threads to take standard input, process it with binaries A, B, and C<

5条回答
  •  醉话见心
    2021-01-02 02:26

    Your calls to subprocess.Popen() implicitly specify the default value of bufsize, 0, which forces unbuffered I/O. Try adding a reasonable buffer size (4K, 16K, even 1M) and see if it makes any difference.

提交回复
热议问题