Re: RFC: loops




On Dec 18, 2005, at 2:26 AM, Daniel Marjamäki wrote:

I'm still trying to find a simple task that I can help you with.
I could make a few loops faster by replacing code such as (gtkaccelgroup.c:305):

[for loop with function call and array access]

Into...

[for loop with function call and pointer iterator]

Do you think this would be a worthwhile effort?

No. This sort of microoptimization is only helpful on tight inner loops, such as the inner loop of a pixel processor. The loop you show as an example calls a function, which is likely to swamp the optimization completely. Additionally, some compilers generate better code for array accesses than for pure pointer math.

However, if you have hard numbers that show this change shaves n percent time off of a normal case, then by all means, please prove me wrong.


Or are there better tasks that I can begin with?

I'll leave this one for someone else; i'm merely out to prevent unnecessary optimization.


--
Our enemies are innovative and resourceful, and so are we. They never stop thinking about new ways to harm our country and our people, and neither do we.
  -- President George W. Bush




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]