Skip to content

Use sets for file membership lookups - #264

Merged
rnc merged 1 commit into
goldmann:mainfrom
rnc:SETS
Nov 10, 2026
Merged

rnc merged 1 commit into
goldmann:mainfrom
rnc:SETS

Conversation

@rnc

@rnc rnc commented Nov 10, 2026

Copy link
Copy Markdown
Collaborator

Track the files seen while squashing in sets instead of lists. The squashed-file, per-layer file and marker-file collections are only used for membership tests and additions, so list scans become O(1) lookups.

Add type hints for the changed collections (typing module forms, so they remain valid on Python 3.7) and a unit test for _files_in_layers covering normalisation of './' prefixed names and the set return type.

Extracted from the "Better squashing" rewrite in
#254

Track the files seen while squashing in sets instead of lists. The
squashed-file, per-layer file and marker-file collections are only used
for membership tests and additions, so list scans become O(1) lookups.

Add type hints for the changed collections (typing module forms, so they
remain valid on Python 3.7) and a unit test for _files_in_layers covering
normalisation of './' prefixed names and the set return type.

Extracted from the "Better squashing" rewrite in
goldmann#254

Co-authored-by: Nixxx11 <nixx@list.ru>
@rnc
rnc requested a review from goldmann November 10, 2026 10:27
@rnc
rnc merged commit 0afc6df into goldmann:main Nov 10, 2026
32 checks passed
@rnc
rnc deleted the SETS branch November 10, 2026 11:08
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