
On Jan 29, 2004, at 9:28 AM, Alexander Terekhov wrote:
Get rid of yield.
Thanks for the suggestion! New timing information: +--------------------+-------+--------+------------+---------+ | | OS | LWM |LWM/no yield| naive | +--------------------+-------+--------+------------+---------+ | CFM contested | 248 | 1.86 | 9.25 | crash | +--------------------+-------+--------+------------+---------+ | CFM uncontested | 28.5 | 1.79 | 1.77 | 0.994 | +--------------------+-------+--------+------------+---------+ | Mach-O contested | 202 | 3.03 | 15.4 | assert | +--------------------+-------+--------+------------+---------+ | Mach-O uncontested | 3.26 | 1.69 | 1.76 | 0.800 | +--------------------+-------+--------+------------+---------+ That lack of yield appears to produce a 400% performance drop for this particular test (contested variant) on these platforms. I understand the potential for priority inversion, but for these performance gains, and for a "cheap fast mutex", the yield looks like a good deal to me. I agree that for a more general purpose mutex other decisions might be made. Thanks for the lwsync tip! Alas, CodeWarrior does not currently support this instruction else I would've included timings for that change too. -Howard