lane icon indicating copy to clipboard operation
lane copied to clipboard

Add a circular buffer data structure

Open oleiade opened this issue 11 years ago • 6 comments

http://en.wikipedia.org/wiki/Circular_buffer

oleiade avatar Jan 24 '14 13:01 oleiade

I have a queue implementation backed by a ring-buffer at https://github.com/eapache/queue - it ends up being much faster because it causes less garbage for the garbage collector.

eapache avatar Jun 23 '14 19:06 eapache

Looks neat!

A few questions:

  • would you be open to the idea of merging it into the lane package. Your license would be respected of course, and your copyright added to the file header.
  • This would imply a few refactoring (done in a specific branch, where everything would be discussed and added through pull requests):
    • Renaming the data structure in order not to conflict with existing namespaces in the lane package.
    • Replacing the panic calls with proper errors return

Let me know what you think :)

oleiade avatar Jun 23 '14 21:06 oleiade

I am open to the idea, though I will continue to maintain the existing one. I use it in https://github.com/eapache/channels/ where the lack of locking is a fairly significant performance improvement (in fact I originally wrote it embedded in that package, and factored it out later).

eapache avatar Jun 23 '14 21:06 eapache

Okay, fair enough. So is it okay for me to adapt your structure in https://github.com/oleiade/lane while keeping your license?

Let me open a specific branch and pull request, and give me you're impressions.

oleiade avatar Jun 23 '14 21:06 oleiade

Go right ahead, the license is MIT which is quite permissive.

eapache avatar Jun 23 '14 22:06 eapache

I also have the following package you can use https://github.com/fzakaria/circularfifoqueue (It was taken from a similar java apache package)

I was thinking if you made

fzakaria avatar Mar 10 '15 16:03 fzakaria