Skip to content

buffer swap optimization on type inference - #23341

Closed
CosmicalBit wants to merge 1 commit into
rust-lang:masterfrom
CosmicalBit:master
Closed

CosmicalBit wants to merge 1 commit into
rust-lang:masterfrom
CosmicalBit:master

Conversation

@CosmicalBit

Copy link
Copy Markdown

Avoids moving pending obligations element by element into the scratch buffer. Swaps the two Vecs instead, turning the transfer from O(n) into O(1).

@CosmicalBit
CosmicalBit marked this pull request as ready for review September 10, 2026 10:47
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 10, 2026
@ChayimFriedman2

Copy link
Copy Markdown
Contributor

First, we're about to share this code with rustc, so we won't change it.

Second, the entire point is to reuse the allocation. Also the N here is usually small.

@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 10, 2026
@ChayimFriedman2

Copy link
Copy Markdown
Contributor

Thank you for your interest in contributing anyway!

@CosmicalBit

Copy link
Copy Markdown
Author

Thank you for your interest in contributing anyway!

Thanks 👍

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.

3 participants