[cairo] Overhead reduction

Vladimir Vukicevic vladimir at pobox.com
Fri May 15 02:34:40 PDT 2009


On 5/15/09 10:27 AM, Jonathan Morton wrote:
> It seems that it's strictly speaking a variable-size array, because it's
> handling a general case.  But most compilers probably don't support the
> dynamic-sized array syntax that GCC does, which would be the cleaner
> alternative to alloca() otherwise.
>
> Perhaps using a fixed allocation on the stack would be appropriate for
> the common case(s) which use very low numbers, and falling back to
> malloc for the general case.

This is the approach that's generally used in places in cairo to handle 
similar problems; if you're needing a larger than usual array, the 
malloc overhead ends up being a much smaller part of the overall percentage.

     - Vlad


More information about the cairo mailing list