[poppler] Why does Gfx::opTab need to be built at runtime?

Albert Astals Cid aacid at kde.org
Wed Sep 26 11:24:07 PDT 2007


A Dimarts 25 Setembre 2007, Krzysztof Kowalczyk va escriure:
> I'm looking at optimizing poppler in  various ways and just noticed
> something I don't understand. I hope someone will be able to enlighten
> me.
>
> In Gfx.h there is:
>
> struct Operator {
>   char name[4];
>   int numArgs;
>   TchkType tchk[maxArgs];
>   void (Gfx::*func)(Object args[], int numArgs);
> };
>
> and in Gfx.cc a table is filled out like this:
>
> Operator Gfx::opTab[] = {
>   {"\"",  3, {tchkNum,    tchkNum,    tchkString},
>           &Gfx::opMoveSetShowText},
>
> According to a profiler, at least on Windows, the single biggest
> function in poppler (~9k) is anonymous function constructed by the
> compiler to fill out Gfx::opTab.

What do you exactly mean with ~9k ?

>
> What I don't understand is why it cannot be constructed at compile time?
>
> Can it be that filling out char name[4] with a string is the cause of that?

Not much idea really, but try try defining the array as static const.

Albert

>
> -- kjk
> _______________________________________________
> poppler mailing list
> poppler at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/poppler




More information about the poppler mailing list