Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions src/byte_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,12 +271,16 @@ impl StorageEnvelope {
/// [`ByteStorage::store`] returns, into `out`, which must be exactly
/// [`encoded_len`](Self::encoded_len) bytes long.
///
/// For a binding that owns the output memory (a Python `bytes`, say): it
/// sizes the buffer with `encoded_len` and writes once, with no
/// intermediate `Vec` and no MessagePack dependency of its own. Measure
/// before using it for envelopes of 64 KiB and up: removing a
/// payload-sized buffer there can make an operation slower under glibc's
/// malloc (see `ByteStorage::store`, which therefore does not).
/// It writes into memory the caller owns, so a binding needs no
/// MessagePack dependency of its own. It is not faster than
/// `ByteStorage::store` plus a copy: the slice writer makes one `memcpy`
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
/// call per field, and a zero-filled output buffer costs what the copy
/// saved. Measured in cachekit-py, it took more instructions per store at
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
/// most sizes below 32 KiB, saved at most 1.5% at any size, and made no
/// end-to-end difference. Measure before using it for envelopes of 64 KiB
/// and up: removing a payload-sized buffer there can make an operation
/// slower under glibc's malloc (see `ByteStorage::store`, which therefore
/// does not).
///
/// # Errors
///
Expand Down
Loading