Skip to content

perf: trim vacant arena tail slots - #267

Closed
tisonkun wants to merge 1 commit into
apache:mainfrom
tisonkun:codex/trim-arena-tail
Closed

perf: trim vacant arena tail slots#267
tisonkun wants to merge 1 commit into
apache:mainfrom
tisonkun:codex/trim-arena-tail

Conversation

@tisonkun

@tisonkun tisonkun commented Sep 2, 2026

Copy link
Copy Markdown
Member

Summary

  • replace the length-dependent vacant-list terminator with a fixed sentinel so the logical slot tail can shrink safely
  • remove occupied tail slots directly and collapse a contiguous vacant tail while retaining the vector allocation
  • cover tail collapse and free-list preservation with focused arena tests

Performance

broadcast::mpmc::unbounded::drain_with_receivers was measured from the merged main baseline and this branch with 30 samples of 20,000 iterations. Representative medians:

Fan-out Baseline This PR Change
peak 32, live 1 48.19 ns 42.24 ns -12.3%
peak 32, live 4 90.09 ns 81.53 ns -9.5%
peak 256, live 1 113.5 ns 40.86 ns -64.0%
peak 256, live 32 545.9 ns 478.8 ns -12.3%

The peak 256, live 1 case now matches peak 1, live 1 (40.86 ns versus 40.81 ns), removing the historical receiver-peak component from the reclaim scan. Interleaved baseline/branch checks of event and completion single-waiter cancellation remained approximately flat.

Validation

  • cargo x check
  • cargo x test
  • cargo x lint

@tisonkun

tisonkun commented Sep 2, 2026

Copy link
Copy Markdown
Member Author

Closing this version because the tail-trimming optimization targets a narrow workload and adds more free-list complexity than the measured absolute savings justify. I will follow up with a smaller change focused only on making the existing free-list representation easier to understand.

@tisonkun tisonkun closed this Sep 2, 2026
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