yes
yes copied to clipboard
fill_up_buffer doesn't fill up as much as it could
fill_up_buffer keeps doubling the amount it fills with each iteration, but this means that it doesn't fill up as much as it could.
For example, let's say the buffer size is 16 bytes, and the output slice is 3 bytes. fill_up_buffer will end up producing a 12-byte result when it could have produced a 15-byte result.
Incidentally, is doubling the buffer length over and over actually faster than just reading the output slice into the buffer repeatedly?