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
Speed up array IO (2.5x - 4x) with nio views as suggested by Kevin Eastridge #414
Conversation
Codecov Report
@@ Coverage Diff @@
## master #414 +/- ##
============================================
+ Coverage 96.99% 97.04% +0.05%
- Complexity 4359 4376 +17
============================================
Files 203 203
Lines 12690 12807 +117
Branches 1852 1875 +23
============================================
+ Hits 12309 12429 +120
+ Misses 155 151 -4
- Partials 226 227 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report in Codecov by Sentry.
|
This works very well, thank you! It is a very noticeable improvement in opening times. I see you added the same for fits writing, which is a great addition. |
More work was done (above) to:
Will need to fill new test coverage holes before merging... |
I did some benchmarking of the new IO speed vs previous releases. In general, reading and writing images is 2.5x -- 4x faster than previous version of the library (e.g. 1.15.2 to 1.17.1) on my laptop with a Gen 3 NVMe SSD. And, reading from |
@attipaci I think the recent commits introduced a regression to table reading. Trying to get the hdu array results in the following exception:
It is also only finding 2 of the 4 hdus. The file is available here |
I was fearing something like this would happen, even though the built-in regression tests passed. Based on the error, it's the binary table (2nd HDU) that reads either too short or beyond its boundary, so it's trying to detect the next HDUs header at the wrong offset -- hence without success. I'll see what I can make of it and create a fix... And, I'll create a new issue for tracking the regression... |
@keastrid has noticed that array IO can be significantly improved by using
java.nio
views (see Discussion #413), so this PR implements that, and provides some minor fixes/improvements to the FITS IO implementation. The buffer views are used for the retrieval of multiple elements only, while single elements are retrieved more efficiently using, e.g.ByteBuffer.getFloat()
directly.