Skip to content

Conversation

@dustinhiatt-wf
Copy link
Contributor

CODE REVIEW

We have buffers in our codebase that are protected with locks and waitgroups for blocking. We need a faster buffer and this is that. This is an MPMC threadsafe ring buffer where threadsafety is achieved using only CAS operations. Makes this buffer pretty fast, and the fixed size ensures bounded sorts of behavior. Calling dispose on this buffer will free any blocked threads with an error returned (unlike panicking with channels).

I'm hoping to use this to speed up the PALM tree.

BenchmarkRBLifeCycle-8 10000000 177 ns/op // involves simultaneous put/get of b.N items
BenchmarkRBPut-8 30000000 58.1 ns/op
BenchmarkRBGet-8 50000000 26.8 ns/op

@alexandercampbell-wf @beaulyddon-wf @tannermiller-wf @rosshendrickson-wf @tylertreat-wf @ericolson-wf @stevenosborne-wf

@tannermiller-wf
Copy link
Contributor

+1 lockless datastructures are very cool

@tylertreat-wf
Copy link
Contributor

+1

@beaulyddon-wf
Copy link

Awesome. +1

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alignment is a little off here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The benchmarking does this for some reason. Pretty annoying.

@stevenosborne-wf
Copy link
Contributor

Super minor. +1

@alexandercampbell-wk
Copy link
Contributor

+1

dustinhiatt-wf added a commit that referenced this pull request Feb 11, 2015
@dustinhiatt-wf dustinhiatt-wf merged commit 82e73db into master Feb 11, 2015
@alexandercampbell-wk alexandercampbell-wk deleted the ring_buffer branch February 11, 2015 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants