Based on issue #33, I have added some features to support buffered inputs for file reading. The code is currently implemented under a new read_plan_buffered method on FilReader but as the behaviour is identical to that of read_plan (barring one optional argument) it may be sensible to replace the original code with the buffered code.
Tests have been updated.
Testing on larger files also shows that this results in a significant performance improvement. For example, testing the time required to read and unpack a 2 GB file on a MacBook with an M2 processor we see a doubling of the performance:
In [48]: %timeit test_buffered()
147 ms ± 1.05 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
In [49]: %timeit test()
330 ms ± 779 µs per loop (mean ± std. dev. of 7 runs, 1 loop each)
Based on issue #33, I have added some features to support buffered inputs for file reading. The code is currently implemented under a new
read_plan_buffered
method onFilReader
but as the behaviour is identical to that ofread_plan
(barring one optional argument) it may be sensible to replace the original code with the buffered code.Tests have been updated.
Testing on larger files also shows that this results in a significant performance improvement. For example, testing the time required to read and unpack a 2 GB file on a MacBook with an M2 processor we see a doubling of the performance: