Unnecessary buffer initialization in ByteQueue::push #1643
Labels
Tag: Performance
Related to improving shadow's run-time
Type: Bug
Error or flaw producing unexpected results
ByteQueue::push
uses the standard library'sRead::read_to_end
. To avoid making uninitialized data available to theRead
implementation, it currently initializes the buffer before passing it toread
.It looks like there's currently an internal / nightly API for marking a reader as promising not to read the buffer it's passed, in which case the initialization will be skipped.
In the meantime we may want to replace our usage of
read_to_end
with something that doesn't pre-initialize.Example from a
perf
report, in a benchmark reading and writing 64 KB buffers via a pipe:We spend almost as much time zeroing the buffer (
__memset_avx2_erms
) as copying the data (read
)The text was updated successfully, but these errors were encountered: