mirror of
https://github.com/boostorg/beast.git
synced 2025-08-02 22:34:32 +02:00
Use memcpy to avoid putting one byte at a time when copying blocks
`memcpy` is likely to be faster than the naive method due to the possibility of use of vector instructions and copying more than a byte at a time. Signed-off-by: Damian Jarek <damian.jarek93@gmail.com>
This commit is contained in:
@@ -1298,9 +1298,8 @@ copy_block(
|
||||
put_short((std::uint16_t)len);
|
||||
put_short((std::uint16_t)~len);
|
||||
}
|
||||
// VFALCO Use memcpy?
|
||||
while (len--)
|
||||
put_byte(*buf++);
|
||||
std::memcpy(&pending_buf_[pending_], buf, len);
|
||||
pending_ += len;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user