The main purpose of this pull request is to fix an inefficiency in the IO between Python programs and Kappa agents. The problem before was that the output from Kappa processes was read one character at a time, which is extremely inefficient. My fix instead reads the output in chunks (using the default buffer size as set by Python module io). The key function that fixes the problem is read_stdout (https://github.com/yarden/KaSim/blob/master/python/kappy/kappa_std.py#L97).
Please proceed with caution as I haven't tested this extensively and kappy doesn't yet have a unit testing suite. But I am pretty certain that the character by character reading was the source of the inefficiency and that simply reading the output in larger chunks dramatically speeds things up.
The main purpose of this pull request is to fix an inefficiency in the IO between Python programs and Kappa agents. The problem before was that the output from Kappa processes was read one character at a time, which is extremely inefficient. My fix instead reads the output in chunks (using the default buffer size as set by Python module
io
). The key function that fixes the problem isread_stdout
(https://github.com/yarden/KaSim/blob/master/python/kappy/kappa_std.py#L97).Please proceed with caution as I haven't tested this extensively and
kappy
doesn't yet have a unit testing suite. But I am pretty certain that the character by character reading was the source of the inefficiency and that simply reading the output in larger chunks dramatically speeds things up.