Page MenuHomeFreeBSD

libfetch: Add read buffering
ClosedPublic

Authored by des on Sat, Jun 27, 2:30 PM.
Tags
None
Referenced Files
F163209643: D57907.diff
Tue, Jul 21, 2:12 AM
Unknown Object (File)
Fri, Jul 17, 5:42 PM
Unknown Object (File)
Mon, Jul 13, 11:22 PM
Unknown Object (File)
Mon, Jul 6, 1:47 AM
Unknown Object (File)
Mon, Jul 6, 12:47 AM
Unknown Object (File)
Mon, Jul 6, 12:43 AM
Unknown Object (File)
Sun, Jul 5, 11:20 PM
Unknown Object (File)
Sun, Jul 5, 7:07 PM
Subscribers

Details

Summary

Previously, we would read FTP control connection messages and HTTP
reponse headers one character at a time. Now, we read as much as will
fit in our buffer and look for a newline. If there is data left over,
it will be reused by the next fetch_getln() call. This also requires
the addition of a fetch_bufread() which takes the buffer into account,
otherwise the start of the HTTP response body will be stuck in the
buffer after we read the last line of the header.

This should noticeably improve HTTP performance, especially for small
transfers.

MFC after: 1 week

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

des requested review of this revision.Sat, Jun 27, 2:30 PM
des planned changes to this revision.Mon, Jun 29, 1:09 PM
des retitled this revision from libfetch: Buffer the FTP control connection to libfetch: Add read buffering.Mon, Jun 29, 1:42 PM
des edited the summary of this revision. (Show Details)
op added inline comments.
lib/libfetch/common.c
1425

wouldn't be better to use a circular buffer?

lib/libfetch/http.c
169

what was the problem with the original tolower? function call overhead?

lib/libfetch/common.c
1425

A fully circular buffer wouldn't work since we use string operations on the contents. We can reduce the amount of copying we do if we change the fetch_getln() API a little, but that's not a priority. The objective was to stop reading FTP and HTTP responses one character at a time, and this achieves that.

lib/libfetch/http.c
169

It's much more than just a function that maps A-Z to a-z; it's locale-dependent.

Bwahh. I've already accepted the changeset, but I've forgotten to click on submit..

This revision is now accepted and ready to land.Sun, Jul 12, 10:11 PM
This revision was automatically updated to reflect the committed changes.