I assume that mutex is now same as fast on windows as on linux, see:
* window example (source here)
-> overhead ~300%raw: 551 ms
boost::mutex: 4087 ms
boost::recursive_mutex: 7007 ms
critical section: 1682 ms
* linux example (source here)
-> overhead ~300%raw: 210 ms
spring::mutex: 600 ms
spring::recursive_mutex: 635 ms
boost::mutex: 648 ms
boost::recursive_mutex: 860 ms
std::mutex: 614 ms
std::recursive_mutex: 634 ms
futex: 469 ms
So cause Spring now uses critsect on windows, we can say any result based on benchmarks done on linux regarding locking are transferable between linux&windows.
Second
So I did a benchmarks of the real overhead of locking by running a demo multiple times, once with locking enabled and once with it disabled. The results are:
While red ones are LockFree. For the FPS this means:
1000/29ms = 34.5FPS (Locking)
1000/27ms = 37.0FPS (LockFree)
So there is a difference of 2.5FPS, hardly `pretty bad` as someone said. Still fanatics might say it would be worth it.
Third
So I made another benchmark of other possible microoptimizations:
* first one is tcmalloc it's a google replacement for the default gcc malloc
* second one is setting the `march` flag, so gcc can optimize the code just for your cpu
The results are:
22.5ms versus 25ms -> nearly the same difference as LockFree
Fourth
So LockFree is not better than other micro-optimizations, and some people expect ways too much from it.