RemoveAllSnapshots has O(n²) duplicate detection for snapshot IDs #12

Open
opened 2026-02-08 17:16:25 +01:00 by clawbot · 0 comments
Collaborator

In snapshot.go RemoveAllSnapshots(), duplicate snapshot IDs are detected with a linear scan:

found := false
for _, id := range snapshotIDs {
    if id == sid {
        found = true
        break
    }
}

This is O(n²) overall. Should use a map[string]bool for O(1) lookups. Same pattern exists in PruneBlobs().

Ref: parent issue #1

In `snapshot.go` `RemoveAllSnapshots()`, duplicate snapshot IDs are detected with a linear scan: ```go found := false for _, id := range snapshotIDs { if id == sid { found = true break } } ``` This is O(n²) overall. Should use a `map[string]bool` for O(1) lookups. Same pattern exists in `PruneBlobs()`. Ref: parent issue #1
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: sneak/vaultik#12
No description provided.