Skip to content

refactor: use VecDeque for change queues#70

Open
qsliu2017 wants to merge 1 commit intomainfrom
refactor/vecdeque-change-queue
Open

refactor: use VecDeque for change queues#70
qsliu2017 wants to merge 1 commit intomainfrom
refactor/vecdeque-change-queue

Conversation

@qsliu2017
Copy link
Copy Markdown
Contributor

Summary

  • Replace Vec<Change> with VecDeque<Change> in SharedTableQueue::changes and PendingDdl::post_changes
  • Vec::drain(..n) from the front is O(remaining) due to element shifting; VecDeque::drain(..n) is O(n_drained)
  • Also reduces Mutex hold time during drain since no shift is needed

Test plan

  • cargo check -p duckpipe-core passes
  • make installcheck -- full regression suite

🤖 Generated with Claude Code

Vec::drain(..n) shifts remaining elements left (O(remaining)),
which also extends Mutex hold time. VecDeque::drain(..n) is O(n_drained).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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