News for hackers. Stuff that matters.
Re:Thread-Safe Lock Free Priority Queues in Golang by jasonwatkinspdx on Friday September 30, 2016 @04:27PM (#12615080)
My experience is that you can lock and unlock a golang mutex in around 130ns, do a cas in around 60ns, and a fetch and increment in around 30ns. So building something atop the atomic primitives is potentially faster, but the difference is not so dramatic that you shouldn't try a simple implementation first.
Re:Thread-Safe Lock Free Priority Queues in Golang by greenleafjacob on Friday September 30, 2016 @05:13PM (#12615325)
Lock free structures typically have worse average or even uniformly worse performance. The issue is what happens under contention or predictability. Lock freedom guarantees that at least one process makes progress whereas with locks a process can acquire a lock and get switched between cores or get GC paused or whatever.