<commit_before>rbuf
====

a circular ring buffer in Golang
<commit_msg>describe project<commit_after>rbuf: a circular ring buffer in Golang
====


type FixedSizeRingBuf struct:

   * is a fixed-size circular ring buffer. Yes, just what is says.

   * We keep a pair of ping/pong buffers so that we can linearize
   the circular buffer into a contiguous slice if need be.

For efficiency, a FixedSizeRingBuf may be vastly preferred to
a bytes.Buffer. The ReadWithoutAdvance(), Advance(), and Adopt()
methods are all non-standard methods written for speed.

For an I/O heavy application, I have replaced bytes.Buffer with
FixedSizeRingBuf and seen memory consumption go from 8GB to 25MB.
Yes, that is a 300x reduction in memory footprint. Everything ran
faster too.

Note that Bytes(), while inescapable at times, is expensive: avoid
it if possible. Instead it is better to use the FixedSizeRingBuf.Readable
member to get the number of bytes available. Bytes() is expensive because
it may copy the back and then the front of a wrapped buffer A[Use]
into A[1-Use] in order to get a contiguous slice. If possible use ContigLen()
first to get the size that can be read without copying, Read() that
amount, and then Read() a second time -- to avoid the copy.

copyright (c) 2014, <NAME>
license: MIT

{'fraction_non_alphanumeric': 0.059505409582689336, 'fraction_numerical': 0.008500772797527048, 'mean_word_length': 4.307377049180328, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3122553', 'n_tokens_mistral': 376, 'n_tokens_neox': 343, 'n_words': 198}