|
Boost : |
From: Levente Farkas (lfarkas_at_[hidden])
Date: 2000-09-13 06:33:57
William Kempf wrote:
>
> I've updated the Win32 implementation again. This version was
> compiled with gcc (using Dev-C++ IDE, which I *think* uses mingwin),
> so the code is closer to ANSI compliant. Other than that, the
> implementation is the same.
>
> Included is a test harness for doing speed comparisons of Win32
> critical sections, Win32 mutexes and the libraries implementation of
> mutex. The results of the timings (one run, so give or take some):
>
> Compiled with VC++
> boost::mutex was 5.68 x faster than Win32 mutex
> boost::mutex was 9.93 x slower than Win32 critical section
> Compiled with gcc
> boost::mutex was 2.63 x faster than Win32 mutex
> boost::mutex was 18.03 x slower than Win32 critical section
my timings are VERY different. my machine is a 450Mhz PIII with 128Mb RAM,
with windows98 4.10.1998. with VC++ 6.0 SP4 (Release version of the test
program) the average times from 5 runs:
------------------
Testing Boost mutex...
102600
Testing Win32 critical section...
320
Testing Win32 mutex...
22800
------------------
boost::mutex is 4.5 x slower than Win32 mutex
boost::mutex is 320 x slower than Win32 mutex
anyway it's when nothing else is running (ie. everything is idle) on the
machine, BUT when something else is running (ie. devstudio is compiling)
win32 primitives are getting faster (!!!) critsec go to ~270, mutex ~11000
I don't know why ?
ps. if you switch the
C/C++ / Code Generation / Use run-time library
to the (Debug) Multithreaded DLL (which is better anyway is you'd like to
use more dll and new iostream) that it's help a little (the above number
are with this settings).
ps. if I've got some time I tye to implement it on linux and make the
mesaurement at the same machine (I've got RH 6.2 too).
-- Levente
"The only thing worse than not knowing the truth is
ruining the bliss of ignorance."
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk