D pointers

Thiago Macieira thiago at kde.org
Sat Oct 1 16:00:38 BST 2005


Stephan Kulow wrote:
> - without inline, the price of d pointers are: one more malloc
>     (can only be spared in KDE 4.0 and is likely to return, so
>     it's a little price and there is no guarantee to be kept - so we
>     better optimize _with_ it already included) and the extra
>     indirection that a d pointer brings (this->member becomes
>     this->d->member). The latter is the real problem

For the first access only in each function or for non-optimised code.

The optimising compiler will very likely elect this->d to be cached in a 
register, just like this itself is.

As Simon pointed out, we can solve that by moving code to the Priv class 
too.

-- 
  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358

1. On frumscafte, hwonne time_t wæs náht, se scieppend þone circolwyrde 
wundorcræftlíge cennede and seo eorðe wæs idel and hit wæs gód.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20051001/23c8f450/attachment.sig>


More information about the kde-core-devel mailing list