Skip to content

Compact retained elements directly in dedup_by - #5

Open
charliermarsh wants to merge 2 commits into
v2from
charlie/codex-v2-compact
Open

Compact retained elements directly in dedup_by#5
charliermarsh wants to merge 2 commits into
v2from
charlie/codex-v2-compact

Conversation

@charliermarsh

@charliermarsh charliermarsh commented Sep 8, 2026

Copy link
Copy Markdown
Member

Summary

Move each surviving element directly into the next hole in dedup_by, instead of swapping the discarded payload back in the other direction. We leave the initial unique prefix in place and drop duplicates as we find them. A guard restores the untouched tail if the predicate or a destructor panics.

Across three Criterion benchmark pairs on x86_64 Linux, removing adjacent duplicates took 47–54% less time for 128-byte elements across inline and spilled vectors, and about 22% less for the large u64 case. The all-equal case just beyond the inline boundary showed no consistent improvement. These benchmarks used regular inputs without destructors.

The added Criterion benchmarks were removed in a follow-up commit and remain in the PR history.

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.

1 participant