Reduce heap escapes in subject tree matching - #8526
Conversation
This stops the pre-allocated `raw` array from heap-escaping as it is no longer passed through an interface boundary unnecessary. Signed-off-by: Neil Twigg <neil@nats.io>
|
Claude finished @neilalexander's task in 2m 40s —— View job Review
Correctness: The refactor is semantically equivalent. Both Why this works: Calling
lp := len(parts)
parts = append(parts[lp:], parts[:lp]...) // reuses extra capacity at tail of rawFor this not to heap-allocate, Stack size trade-off: Each No concurrency concerns: All state ( No security concerns: Pure algorithmic refactor with no trust boundary changes. The change is clean and well-reasoned. No issues. |
This stops the pre-allocated
rawarray from heap-escaping as it is no longer passed through an interface boundary unnecessarily.Before:
After: