Skip to content

perf: less redundant opening when files fail#5267

Merged
lgritz merged 1 commit into
AcademySoftwareFoundation:mainfrom
lgritz:lg-use_valid
Jun 29, 2026
Merged

perf: less redundant opening when files fail#5267
lgritz merged 1 commit into
AcademySoftwareFoundation:mainfrom
lgritz:lg-use_valid

Conversation

@lgritz

@lgritz lgritz commented Jun 27, 2026

Copy link
Copy Markdown
Collaborator

When creating an ImageInput, if the initial guess (based on the file extension) fails to open, we try all the others in turn.

This tries to make that a little cheaper by not doing a full open() but instead first checking for valid_file, which in theory is a much less expensive approximate check.

When creating an ImageInput, if the initial guess (based on the file
extension) fails to open, we try all the others in turn.

This tries to make that a little cheaper by not doing a full open()
but instead first checking for valid_file, which in theory is a much
less expensive approximate check.

Signed-off-by: Larry Gritz <lg@larrygritz.com>

@jessey-git jessey-git left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, the original code here always struck me as a odd to only do this for the do_open case.

@lgritz lgritz merged commit 88cde4b into AcademySoftwareFoundation:main Jun 29, 2026
27 checks passed
@lgritz lgritz deleted the lg-use_valid branch June 29, 2026 20:57
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