D pointers

Michael Pyne pynm0001 at comcast.net
Sat Oct 1 19:23:34 BST 2005


On Saturday 01 October 2005 13:57, Thomas Braxton wrote:
> This is a small test i made up to see the difference of d-pointers on
> register pressure. The test has two classes with exactly the same members,
> one using a d-pointer the other not.

Good idea, but I don't think this is useful in practice.  AFAIK the 
optimization of any such code would depend on the "register-neediness" of the 
surrounding code.  Perhaps having functions that had a few loops around calls 
to this->d->foo would be more realistic, although I'm sure someone smarter 
than myself can think of a better testcase.

> Compile with g++ -O3 -g3 -fPIC -c test.cpp

I think -O3 is unrealistic as well.  Either -O2 or -Os would be a better 
real-world flag IMHO.

With that said, I don't really think that "register pressure" is a convincing 
argument, and any such effects could probably be mitigated by coding (such as 
caching values used in inner loops).  And this hasn't taken into account any 
of the possible benefits of this anyways.

Of course for now all we have is Lubos's numbers which seem to indicate that 
any such performance hit is non-fatal, and of course the Qt 4 example where 
QSA is faster even though it's using a library that uses D pointers even more 
heavily than before.

Regards,
 - Michael Pyne
-------------- 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/282f614e/attachment.sig>


More information about the kde-core-devel mailing list