From: Fabian K. <fk...@fa...> - 2011-01-02 13:44:12
|
Lee <le...@gm...> wrote: > On 1/1/11, Fabian Keil <fk...@fa...> wrote: > > Lee <le...@gm...> wrote: > > > >> On 12/31/10, Fabian Keil <fk...@fa...> wrote: > >> > Lee <le...@gm...> wrote: > > It would probably be worth investigating why using curl without Privoxy can > > be about twice as fast. I don't think the difference has to be that big. > > I'd guess about a 2X difference if you're doing everything on the same machine: > Without privoxy, curl gets the data & sends the data. > With privoxy, curl gets the data & sends it to privoxy which gets > the data & sends the data. You're right. I suspected the test was still somewhat network-bound, when apparently it's not. However we still may be able to reduce the difference by reducing Privoxy's CPU use (when only passing the data through), by using multiple buffers in chat() to make it more zero-copy friendly. > How hard is FreeBSD to set up? No idea when I'd be able to do it, but > Dummynet (http://info.iet.unipi.it/~luigi/dummynet/) seems like the > thing to use for testing privoxy speed patches. Configure something > like a 25Mb/s link with 50ms of delay and you'd have a realistic > testbed for privoxy that should give much more consistent results than > using the Internet. Nowadays Dummynet has support for Windows, too, so setting up FreeBSD should be optional. > Another one of my suspicions is that using a buffer size that's a > multiple of 1460 bytes in chat would be a little bit faster. For me, > at home, TCP/IP has a max packet size of 1500 bytes; subtract 40 bytes > for IP and TCP headers and you've got 1460 bytes. I added a log msg > in read & write_socket and almost all the network reads were multiples > of 1460 bytes, so having a buffer that's a multiple of 1460 seems like > the Thing To Do. I'm not sure why it should matter as long as the buffer is large enough not to cause fragmentation. While unused buffer space could be considered a waste, it's probably not significant enough to affect performance. Of course we'll never now until somebody benchmarks it. > > I'm wondering if the difference is statistically significant. > > I don't think so - see the attached privoxy log file. (I haven't kept > up with name changes, so it should be "socket_is_still_alive" instead > of "socket_is_still_usable" in the log) buffer_and_filter_content > starts out as zero and doesn't get set, so it seems to be the same as > my original > 0 && !socket_is_still_alive(csp->cfd) > test Great. Patch committed. Fabian |