How to speed up communication with subprocesses

后端 未结 5 840
佛祖请我去吃肉
佛祖请我去吃肉 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:36

    Since you talked about popen() and pthreads in comments, I guess you are under a POSIX system (maybe Linux). So did you try to use subprocess32 instead of the standard subprocess library.

    Its use is strongly encouraged by the documentation and may lead to some improvment.

    PS: I believe mixing forks (subprocess) and threads is a bad idea.

    PS2: Why python produceA.py | A | python produceB.py | B | python produceC.py | C does not fit your needs ? Or its equivalent using subprocess ?

提交回复
热议问题