Repository navigation
Conversation
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.
_next_image_partname()checks candidate numbers against a list of image numbers already in use. Store those numbers in a set so these checks no longer repeatedly scan the list. The search still returns the lowest available number and reuses gaps.Name allocation becomes expected O(n) instead of O(n²) per new image, at the cost of some additional temporary memory.
Full-operation timings against
e45454602b53e8e572b179ccf1c91093ec9f4ed7, using CPython 3.12.6 on Windows 11 with generated 64×48 thumbnails. Timings include document creation or loading, picture insertion, and saving.Paired-run medians after one warmup pair, alternating execution order with fresh inputs. Every ZIP entry's contents and order, image names, and shape counts matched exactly. Small and repeated-image controls were approximately unchanged.
Validation: 1,609 existing unit tests and 650 acceptance scenarios passed; Ruff lint, formatting, and
git diff --checkpassed. Existing tests cover choosing the next number and reusing gaps; no test files changed.AI-assisted investigation, implementation, benchmarking, and drafting with Codex.