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

Optimize single-tile reads #348

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

thejohnhoffer
Copy link

@thejohnhoffer thejohnhoffer commented Jan 26, 2023

This resolves issue #347. The _bulkReadable function detects when a single read should match an IFD buffer byte-for-byte. Instead of extracting every single pixel individually, this PR copies the IFD buffer to a single typed array whenever possible.

For our test case loading unsigned 16-bit 1024x1024 tiles, I observe this optimization is 4x faster thanv2.0.7.

I have written the code to optimize only when possible:

  • Requesting a single non-interlaced tile without color planes
  • Ensuring the byte order of the device matches the image byte order

Testing

  • I have not yet tested with multiple formats / byte counts.
  • I have not yet tested on a big endian OS.

@potion-cellar
Copy link

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants