[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: Flickering problem in kicker (trunk)
From:       Henrique Pinto <henrique.pinto () kdemail ! net>
Date:       2006-10-15 13:25:50
Message-ID: 200610151125.50269.henrique.pinto () kdemail ! net
[Download RAW message or body]

On Sun 15 Oct 2006 09:40, Rafael Fernández López wrote:
> > ( * )  KIconLoader * ldr = KGlobal::iconLoader();
> >
> > >        QPixmap icon = ldr->loadIcon(info.icon(), K3Icon::Panel,
> > > K3Icon::SizeLarge);
> > >
> > >        can be done in one step:
> > >
> > >        QPixmap icon = KGlobal::iconLoader()->loadIcon( info.icon(),
> > > K3Icon::Panel, K3Icon::SizeLarge);
> >
> > this should make no practical difference in running time. putting code
> > on one
> > line does not magically make it faster ;)
>
> Well, not in time to the user, but if we can avoid innecesary assignments
> we should, that's clock time to the computer, and the machine needs that
> time for assignments (I know, is a pointer, but it is an assignment...)

Have you checked that there is actually any difference at all? With 
optimizing compilers, I really don't think that having it in two lines 
would be slower than putting it all in a single line. Could you check if 
there's any difference in the assembly code created for the two versions?

> > ( * ) Here you're losing too many time:
> > >        if ((*it).isHidden() || (*it).name().isEmpty() ||
> > >            ((*it).isUniqueApplet() &&
> > >             PluginManager::self()->hasInstance(*it)))
> > >
> > >        I consider is faster only de-referencing "it" one time, and
> > > then
> >
> > use
> >
> > > that object instead of de-referencing lots of times as is done right
> >
> > now.
> >
> > you could, sure. but again, have you done any benchmarking of this or
> > is it an
> > educated guess on your part that this would help?
>
> I haven't done a benchmark, but dereferencing one time is faster than
> dereferencing 5 times, I think it is obvious. But anyway I'd like to know
> how to benchmark ;)

Won't the compiler also optimize this?
I don't think 5 dereferences would hurt performance, though, and "premature 
optimization is the root of all evil". Without tests showing that there's a 
significant difference, I don't see a point in changing this.

-- 
	Henrique Pinto
	henrique.pinto@kdemail.net
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic