oleiade / lane

Generic PriorityQueues, Queues, Stacks, and Deque data structures for Go
https://pkg.go.dev/github.com/oleiade/lane#pkg-types
MIT License
877 stars 76 forks source link

Add a circular buffer data structure #2

Open oleiade opened 10 years ago

oleiade commented 10 years ago

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

eapache commented 10 years ago

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.

oleiade commented 10 years ago

Looks neat!

A few questions:

Let me know what you think :)

eapache commented 10 years ago

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).

oleiade commented 10 years ago

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.

eapache commented 10 years ago

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

fzakaria commented 9 years ago

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