Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 5 commits into from
Apr 4, 2024
Merged

Conversation

ewanbarr
Copy link
Contributor

@ewanbarr ewanbarr commented Apr 2, 2024

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)

@ewanbarr ewanbarr marked this pull request as ready for review April 2, 2024 22:36
@pravirkr pravirkr added the enhancement New feature or request label Apr 3, 2024
@pravirkr pravirkr linked an issue Apr 3, 2024 that may be closed by this pull request
@pravirkr pravirkr merged commit e962bba into FRBs:main Apr 4, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: buffered file reads
2 participants