[poppler] Openjpeg2 patches: Why de-inline doGetChar?

Adam Reichold adam.reichold at t-online.de
Mon Jan 5 12:24:59 PST 2015


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Hello,

Am 04.01.2015 um 23:44 schrieb Albert Astals Cid:
> El Dilluns, 5 de gener de 2015, a les 08:53:26, Adrian Johnson va
> escriure:
>> On 05/01/15 08:39, Albert Astals Cid wrote:
>>> Adrian, any reason you de-inlined doGetChar in the patches for
>>> openjpeg2?
>>> 
>>> As far as i remember when i made this function inline it got us
>>> a not so bad free speed increase.
>> 
>> When I wrote the patch I moved all openjpeg specific types and
>> code into the .cc file. I could not figure out how to make an
>> inline function in the .h access the JPXStreamPrivate struct that
>> is defined in the .cc file.
> 
> I see :/
> 
> Cheers, Albert

Looking at the implemenation, both "doGetChar" and "doLookChar" will
always be called inside "JPEG2000Stream.cc" via the virtual methods
"getChar(s)" and "lookChar", so I'd say we could just mark the
implemenations as "inline" as the compiler can still inline within the
compilation unit.

Actually, I think there is no compelling reason to have those present
in the header at all, as they always seem to access the data via the
"priv" pointer anyway, so I'd say the declarations like

static inline int doGetChar(JPXStreamPrivate* priv);
static inline int doLookChar(JPXStreamPrivate* priv);

only within the source file could open even more possibilities for
compiler optimizations. (You could probably also make them inline
methods of "JPXStreamPrivate" as well, but then the compiler would
have to infer the effective linkage. Maybe we could put the whole
definition of "JPXStreamPrivate" within the anonymous namespace anyway?)

Best regards, Adam.

>> 
>>> Cheers,
>>> 
>>> Albert
>>> 
>>> _______________________________________________ poppler mailing
>>> list poppler at lists.freedesktop.org 
>>> http://lists.freedesktop.org/mailman/listinfo/poppler
>> 
>> _______________________________________________ poppler mailing
>> list poppler at lists.freedesktop.org 
>> http://lists.freedesktop.org/mailman/listinfo/poppler
> 
> _______________________________________________ poppler mailing
> list poppler at lists.freedesktop.org 
> http://lists.freedesktop.org/mailman/listinfo/poppler
> 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBCAAGBQJUqvMWAAoJEPSSjE3STU34LzsH/ilUb3yh6zi5f/C1NQo27bFy
jXW5mwbwNYmyPwWdc/cXAtz6KsTipmpPaivUruOS/DbSiE0+c1jvoDLNifYJW2bm
TfTGGDHf/GlNqMgfBesvKs2QrL1o726MrRHdqgTshg+L9+Lg3GKIJXuw9jR7WHSe
hMh11Y8MX++jWPQlz0QmPxGp92Qr6qi7sApOyG+jYyF8lk6v9ORQsCm4aHJa82Kx
MWtGCAVlt3BdNOUXTZbfz5htqs3FaaJes6EC8+RssV97SZvMpTMT4P8jJs1q3xZB
EoMTTMyEl/3qHGSIXphvB3rsJ/bOUgKldLmQBFI/afuM8khXkSnmO95bWS9JuPk=
=77u8
-----END PGP SIGNATURE-----


More information about the poppler mailing list