Skip to content

Conversation

@JohnTitor
Copy link
Member

PR Type

INSERT_PR_TYPE

PR Checklist

  • Tests for the changes have been added / updated.
  • Documentation comments have been added / updated.
  • A changelog entry has been made for the appropriate packages.
  • Format code with the nightly rustfmt (cargo +nightly fmt).

Overview

  • reuse total_len instead of caluculating
  • prefer BytesMut::split over mem::take to avoid reallocations
  • skip calling extend_from_slice to avoid unnecessary copy

@JohnTitor JohnTitor merged commit 049d638 into actix:main Feb 3, 2026
9 checks passed
@JohnTitor JohnTitor deleted the perf-tweak-ws branch February 3, 2026 11:50
@asonix
Copy link
Contributor

asonix commented Feb 3, 2026

Using mem::take here was to prevent the BytesMut from growing unbounded with large payloads and never shrinking again.

See: JohnTitor@8195484
And: actix/actix-web#3367

@JohnTitor
Copy link
Member Author

@asonix Ah, that makes sense, thank you for pointing out! I'll partially revert it and add a note later.

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.

2 participants