[cairo] Overhead reduction

Soeren Sandmann sandmann at daimi.au.dk
Thu May 21 11:55:50 PDT 2009


Soeren Sandmann <sandmann at daimi.au.dk> writes:

> Is there a reason we can't just use thread local storage? It seems all
> compilers we care about support either __thread or declspec(thread).
> In my limited testing on a P4, the overhead of using a thread local
> variable seemed to be on the order of 100 cycles, which considering
> everything else going on during image allocation, really isn't a big
> deal.

I just realized that this will leak the images when the thread exists,
and that there is no good way to fix that without using something like
pthread_set_specific().

Given that, I think I'd prefer to just have a free-list protected by a
mutex. We can use the code from cairo-mutex-impl-private.h; everybody
who committed to that file agreed to a relicense to MIT.


Soren


More information about the cairo mailing list