Skip to content

perf(html): use indexed parent lookup - #4417

Merged
cragwolfe merged 3 commits into
Unstructured-IO:mainfrom
KRRT7:perf-html-parent-map
Jul 26, 2026
Merged

perf(html): use indexed parent lookup#4417
cragwolfe merged 3 commits into
Unstructured-IO:mainfrom
KRRT7:perf-html-parent-map

Conversation

@KRRT7

@KRRT7 KRRT7 commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Replace repeated linear parent lookups during HTML element reconstruction with a precomputed element ID map.

Performance

This changes parent lookup from O(elements × parents) to O(elements + parents), improving scalability for documents with many hierarchical HTML elements.

Review in cubic

@KRRT7
KRRT7 marked this pull request as ready for review July 21, 2026 20:35

@cubic-dev-ai cubic-dev-ai Bot 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.

No issues found across 2 files

Shadow auto-approve: would auto-approve. This is a bounded performance refactor that replaces a linear scan with a precomputed dictionary lookup, preserving all existing behavior.

Re-trigger cubic

@cubic-dev-ai cubic-dev-ai Bot 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.

0 issues found across 2 files (changes from recent commits).

Shadow auto-approve: would auto-approve. Optimizes parent lookup using a precomputed index, preserving behavior. Bounded internal refactor with clear performance benefit.

Re-trigger cubic

@cragwolfe
cragwolfe added this pull request to the merge queue Jul 22, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 22, 2026
@KRRT7

KRRT7 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

@cragwolfe

=========================== short test summary info ============================
FAILED test_unstructured/metrics/test_evaluate.py::test_text_extraction_evaluation - OSError: Cannot save file into a non-existent directory: '/home/runner/work/unstructured/unstructured/test_unstructured/metrics/../../example-docs/test_evaluate_files/test_evaluate_results_cct'
====== 1 failed, 3637 passed, 13 skipped, 2 xfailed in 990.08s (0:16:30) =======
make: *** [Makefile:34: test] Error 1
Error: Process completed with exit code 2.

transient issue.

@KRRT7
KRRT7 requested a review from cragwolfe July 23, 2026 00:01
@cragwolfe
cragwolfe added this pull request to the merge queue Jul 23, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 23, 2026
@cragwolfe
cragwolfe added this pull request to the merge queue Jul 26, 2026
Merged via the queue into Unstructured-IO:main with commit 441b9d6 Jul 26, 2026
55 checks passed
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