PruneBlobs has O(n²) duplicate snapshot ID detection #16

Closed
opened 2026-02-08 17:16:28 +01:00 by clawbot · 1 comment
Collaborator

In prune.go PruneBlobs(), same O(n²) linear scan for duplicate snapshot IDs as RemoveAllSnapshots:

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

Use a map[string]bool instead.

Ref: parent issue #1

In `prune.go` `PruneBlobs()`, same O(n²) linear scan for duplicate snapshot IDs as `RemoveAllSnapshots`: ```go found := false for _, id := range snapshotIDs { if id == snapshotID { found = true break } } ``` Use a `map[string]bool` instead. Ref: parent issue #1
clawbot self-assigned this 2026-02-20 09:29:02 +01:00
clawbot added the needs-review label 2026-02-20 09:29:03 +01:00
Author
Collaborator

Closing as duplicate — PR #45 (which closes #12) fixes the O(n²) dedup in both RemoveAllSnapshots and PruneBlobs.

Closing as duplicate — [PR #45](https://git.eeqj.de/sneak/vaultik/pulls/45) (which closes [#12](https://git.eeqj.de/sneak/vaultik/issues/12)) fixes the O(n²) dedup in both `RemoveAllSnapshots` and `PruneBlobs`.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/vaultik#16