Commit 6651596
src: reserve shared_array_buffers capacity in Message::Deserialize
shared_array_buffers grows via repeated push_back() while iterating
shared_array_buffers_, even though shared_array_buffers_.size() is
already known before the loop starts and is an exact count of how
many items will be pushed (one per iteration, unconditionally).
This reserves capacity upfront to avoid the repeated allocate/copy/
free cycle that happens each time capacity is exceeded, mirroring
the existing array_buffers.reserve() in the sibling
Message::Serialize().
Signed-off-by: agape1225 <49804691+agape1225@users.noreply.github.com>
PR-URL: #65304
Reviewed-By: James M Snell <jasnell@gmail.com>1 parent 37b3db9 commit 6651596
1 file changed
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
190 | 190 | | |
191 | 191 | | |
192 | 192 | | |
| 193 | + | |
193 | 194 | | |
194 | 195 | | |
195 | 196 | | |
| |||
0 commit comments