Skip to content

Conversation

@radarhere
Copy link
Member

To restore the previous position after a read,
seek relative to the current position,
rather than using tell() and then seeking relative to the start of the file.

@hugovk
Copy link
Member

hugovk commented Jan 31, 2025

The PR is marginally faster than main:

main

python -m timeit -s 'from PIL import Image' 'Image.open("Tests/images/gfs.t06z.rassda.tm00.bufr_d")'
20000 loops, best of 5: 13 usec per loop

PR

python -m timeit -s 'from PIL import Image' 'Image.open("Tests/images/gfs.t06z.rassda.tm00.bufr_d")'
20000 loops, best of 5: 12.7 usec per loop

@hugovk hugovk merged commit 793e1fc into python-pillow:main Jan 31, 2025
52 checks passed
@radarhere radarhere deleted the seek branch January 31, 2025 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants