FRBs / sigpyproc3

Python3 version of Ewan Barr's sigpyproc library
https://sigpyproc3.readthedocs.io
MIT License
14 stars 11 forks source link

#33 Implementation of buffered file read (WIP) #34

Closed ewanbarr closed 5 months ago

ewanbarr commented 6 months ago

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)