D pointers

Shaheed srhaque at iee.org
Mon Oct 3 21:12:27 BST 2005


On Saturday 01 October 2005 10:54, Zack Rusin wrote:
> On Friday 30 September 2005 18:17, you wrote:
> > My argument for flatten-where-possible is based on the need for extra
> > allocations and indirections.
>
> Which as people have already told you makes absolutely no difference and
> is pointless.

The closest your email, to which I was responding, came to presenting numbers 
was the remark "QUrl does create a Private and is probably around 10x faster 
so maybe you should find a different example of where not using a d-pointer 
was beneficial for KDE (in fact I dare you to do so :) ).".

I have seen systems where an extra allocation could require the taking of a 
process-wide lock, and it was not obvious to me that your number was a 
reasonable predictor of the memory allocation overhead. Since then I have 
seen Lubos' numbers, and the followups to them, but that's not the same as 
automatically taking your original email as having any more intrinsic value 
than my experience of performance issues.

> > I don't know what you mean by loss of flexibility: I never proposed
> > getting rid of the d pointer - only not using it when possible.
>
> No, that's not what I meant. Once you have members in the class you
> can't get rid of them, that's a loss of flexibility. And the argument
> that these classes are stable doesn't hold. Stable != won't change
> anymore. In our field saying that some code won't ever be changing is
> almost saying no one will be maintaining it anymore and it's
> deprecated.

Makes sense to me.

> > > Also if you want real world example of what kind of effect porting
> > > of Qt 3 app to Qt 4 has look at:
> > > http://blogs.qtdeveloper.net/archives/2005/08/24/qsa-120/
> >
> > Nice anecdote, but beside the point.
>
> I'm not sure whether you have some identity crisis which I should be
> aware of  but if I wanted to reply to your email only, top of that
> email wouldn't say:
> "On Wednesday 28 September 2005 22:31, Stephan Kulow wrote:"
> Maybe you're going through one of the "Wanna be like Coolo" phases, but
> trust me I know him and you're not it. So since he was complaining
> about the speed of Qt 4 this part was right on the money.

I saw no such comment in your email. Perhaps I missed this in an earlier 
thread.

> > Even without a convenient
> > algorithm change, if you start with a non-empty d-pointer structure
> > and you flatten it out, you will go faster.
>
> Oh, sure, you'll also go faster if you code it all in one big main
> function or even better write it in assembly. Hell, machine code all
> the way and we'll be flying...
> The bottom line is this: people have shown you that the performance
> difference is negligible so flattening d-pointers makes no difference.
> The performance argument is bogus. And unless you can provide
> performance measurements of where it really matters you don't have an
> argument. At all.

I hope I never gave the impression of being a zealot. I put forward an idea, 
and was trying to make sure it got a fair airing - at times, it seemed people 
were misunderstanding what I was suggesting.

Thanks, Shaheed




More information about the kde-core-devel mailing list