On Thu, Jun 26, 2014 at 9:37 AM, Arne Becker <arne_bec...@genua.de> wrote: > 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
My circular buffer never made more than 2 reads or writes per read or write call, and very often only one. this BIP is just a proper implementation as far as i am concerned. does'nt change you are on the stack with the buffer, and this is not good (right?) Only system devs may explain this accurately and i do not want to make wrong statement anyway. Moreover there 's architecture i have never used that may behave differently. -- --------------------------------------------------------------------------------------------------------------------- () ascii ribbon campaign - against html e-mail /\