|
|
|
|
|
by liblfds
3677 days ago
|
|
The lock-free binary tree on two cores is about 2x faster than the next best method. On sixteen cores, about 20x faster. Why not use it, if it's packaged up in a library? it's only the difference between typing one API or another, unless there are functionality differences. |
|
The only lock-free data structure that is practical is a queue. And that's because a lock-free queue is really the only data structure that doesn't require you to re-architect your entire application stack according to the limitations of the lock-free data structure. And if you're going to re-architect your application, better to re-architect it around message passing, which mostly obviates the need for lock-free data structures, with queues, again, being the obvious exception.
But it's comparatively trivial to implement a lock-free queue using intrinsics, assuming it's a hot-spot in your application. Library dependencies are extremely costly in terms of the long-term maintenance of software projects. Supplying a lock-free queue in a single C file (or header) using common compiler intrinsics, OTOH, and which automagically can be dropped into most existing projects, might be much more useful.