Merged
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
badGarnet
approved these changes
Feb 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Improve PDF fast strategy cold-start latency by lazy-loading hi-res-only imports in pdf.py.
This reduces first-call startup overhead without changing partition behavior.
Local benchmarks show a significant fast strategy cold-start speedup of ~35% from 2.75s -> 1.78s.
They also show a small hi_res slowdown (~2-4%), which is acceptable given the fast improvements.
Benchmark was run on 6 pdfs
https://github.com/Unstructured-IO/unstructured/blob/main/example-docs/pdf/DA-1p.pdf
https://github.com/Unstructured-IO/unstructured/blob/main/example-docs/pdf/chevron-page.pdf
https://github.com/Unstructured-IO/unstructured/blob/main/example-docs/pdf/embedded-images-tables.pdf
https://github.com/Unstructured-IO/unstructured/blob/main/example-docs/pdf/fake-memo-with-duplicate-page.pdf
https://github.com/Unstructured-IO/unstructured/blob/main/example-docs/pdf/interface-config-guide-p93.pdf
https://github.com/Unstructured-IO/unstructured/blob/main/example-docs/pdf/layout-parser-paper-fast.pdf
Note
Medium Risk
Touches core PDF partitioning by changing import timing and locations; behavior should be unchanged but there is some risk of missed/conditional imports causing runtime errors in less-tested hi_res/OCR/analysis paths.
Overview
Improves PDF
faststrategy cold-start performance by lazy-loading hi-res-only dependencies inunstructured/partition/pdf.py(moving severalpdf_image/unstructured_inference-related imports into_partition_pdf_or_image_localand other hi-res/OCR-only code paths), while keeping thefastpath lighter.Adds
scripts/performance/quick_partition_bench.pyfor quick local cold vs warm partition timing across one or more PDFs, updates the table metrics helper to importconvert_pdf_to_imagesfrompdf_image_utils, and bumps the library version to0.20.4with corresponding changelog entry.Written by Cursor Bugbot for commit b66ae0e. This will update automatically on new commits. Configure here.