Hi.

> If the buffer is fixed, dont bother memmove it, just remember the
> begining and the end:
> http://en.wikipedia.org/wiki/Circular_buffer

There's a tradeoff - lots of memmove vs. lots of very small reads/writes
if you get near the end of the buffer. My gut feeling told me that local
things, even if they require a syscall, will be a lot faster than things
over the network, so I chose the version with larger reads and writes.

A BIP buffer [1] would be the best solution to this problem.
If such a thing already exists in the codebase, please point me to it.

For this diff, I benchmarked the binary, and found no significant change
in speed versus the previous implementation. I haven't really paid
attention to resource usage.

[1]
http://www.codeproject.com/Articles/3479/The-Bip-Buffer-The-Circular-Buffer-with-a-Twist

Reply via email to