[SDL] threading overhead

Mattias Engdegård f91-men at nada.kth.se
Sun Apr 9 15:00:08 PDT 2000

>Notice the 4-5 seconds more time it takes to execute and the variance
>with the multi-threaded version.

Running time: 7358 ms (multi-threaded)
Running time: 7303 ms (multi-threaded)
Running time: 7298 ms (multi-threaded)
Running time: 7294 ms (multi-threaded)
Running time: 7331 ms (multi-threaded)
Running time: 7291 ms (single-threaded)
Running time: 7326 ms (single-threaded)
Running time: 7279 ms (single-threaded)
Running time: 7295 ms (single-threaded)
Running time: 7281 ms (single-threaded)

for Solaris 2.6, gcc without optimization. Oh, yes, I filled your malloc()ed
buffers just to be sure that we don't memcpy() from a single COW zero page,
but it didn't really change the results.

>I was expecting this, but I was wondering if any multithreading
>proponent had anything to say on my code?

I'm not a MT proponent (rather the opposite), but your code is quite sensitive
to cache sizes, not only the thread implementation. I'm somewhat amazed that
cache misses + kernel overhead eats as much as 0.5ms per iteration though.

More information about the SDL mailing list