curl-library
Re: Info request about the zero copy interface (2)
Date: Mon, 5 Dec 2005 14:04:48 +0000
Legolas wrote:
> >Legolas' pattern requires each decompressed data chunk to be then
> >_copied_, from the algorithm's 32k buffer, to the application's
> >supplied buffer. That is more copies than necessary.
> >
> No, the library is aware of a destination buffer and can write to it.
> Again, give a look at the pseudo-code in the previous reply please.
You mean this part? :
> MainLoop:
> received_size = recv(yoursocket, internal_buffer,
> internal_buffer_size, yourflags);
> buffer_size = forecast_size(received_size);
> /* forecast someway by libcurl */
> buffer = write_buffer(custom_data, &buffer_size);
> /* application may return a bigger buffer */
> ...(decode SSL, join chunks...)
> /* work on received data putting final result data into
> 'buffer' */
> write_callback(custom_data, final_size);
> /* previous code must set 'final_size' to the size of data
written to 'buffer' */
The line followed by the comment "work on received data putting final
result data into 'buffer'" copies data into 'buffer'. That copy is
not necessary. In what way is this doing "zero-copy"?
-- Jamie
Received on 2005-12-05