python - Avoid multiple subprocess Popen -
i using popen use case (this skeleton/idea):
cipherstr = sys.argv[1] cmd = 'openssl ciphers -v %s' % cipherstr p = subprocess.popen(shlex.split(cmd)) p.wait() at end of this, consume output list of ciphersuites. can see, every call module invoke new openssl process. latency of each invocation 40ms (expensive 1000s of calls).
my goal keep openssl process active , communicate cipherstr through unix socket/pipe. way have 1 invocation of openssl, running process returning output based on varying input.
afaict, openssl ciphers not read file undermines hypothesis.
do have alternative?
i not think there way turn program accepts 1 word input data kind of permanently running "service", responding number of queries.
if not want re-implement openssl ciphers -v <word>, there seems remain 1 way speed queries: put results in cache.
Comments
Post a Comment