[MPlayer-dev-eng] [PATCH] use pthreads for caching

Uoti Urpala uoti.urpala at pp1.inet.fi
Sat Jan 27 16:45:20 CET 2007


On Sat, 2007-01-27 at 10:09 -0500, Rich Felker wrote:
> Yes. It's not a matter of the implementation being fast or slow. It's
> fundamentally impossible to make synchronization fast. Each "lock"
> prefix requires a couple hundred cycles on my machine, and I'm told
> it's even worse on machines with higher clocks.

Where did you get those numbers? On a 1837 MHz machine with up to date
software this loop

    for (int i=0; i < 100000000; i++) {
	pthread_mutex_lock(&mut);
	pthread_mutex_unlock(&mut);
    }

takes about 3.9 seconds. That means 72 cycles per loop, and less than 36
cycles per call - and that's with function call overhead included.




More information about the MPlayer-dev-eng mailing list