Poor/erratic boost::interprocess named_semaphore performance
I'm experiencing performance issues using named semaphores on Windows 7 x64. Currently, I'm on 1.49 beta 1, but the behavior was similar on 1.48 and 1.47. Below, I'm copying two sample programs. They simply synchronize with one another using a pair of semaphores. To run them, start the first program and then the second. They will synchronize with each other 100k times and then the second program will spit out the elapsed time. You can restart the second program to run again without bringing down the first program.
On Windows, the elapsed time the first time around is anywhere from 20 - 40 seconds. If you leave the second program running, the following run will be only about 2-3 seconds. A third run it will be back up to 20-40 seconds, and it will keep bouncing back and forth like that. On Linux, the total elapsed time is consistently less than half a second.
I'm guessing the Windows implementation isn't as efficient, but I wouldn't expect it to be 100 times slower than Linux. The other perplexing thing is how wildly different the results are on Windows from run to run.
=====================Test1.cpp==========================================
#include
participants (1)
-
Davidson, Josh