comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: () and execution speed
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: () and execution speed [message #44950] Fri, 29 July 2005 09:27 Go to next message
Ken Mankoff is currently offline  Ken Mankoff
Messages: 158
Registered: February 2000
Senior Member
On Fri, 29 Jul 2005, Gert wrote:
> I just played with and array of structures, each structure
> containing a (float) images. If i do
>
> SomeProc, psData[NumStruct].flIm[1:1000]
>
> or
>
> SomeProc, (psData[NumStruct].flIm)[1:1000]
>
> then the result is the same, but the second runs much slower.
> Anyone knows why this is so? My guess is that in the second run, a
> copy of the array is made.

Sounds like a good guess. A compiler optimization might be able to
catch the above special case, but () changes the precedence. You
could have (x[y].z +1)[42] so direct memory access won't work.

> I would be interested to find out if there are more 'pitfalls' out
> there.
TVSCL? The decompose keyword to DEVICE?

-k.
Re: () and execution speed [message #44951 is a reply to message #44950] Fri, 29 July 2005 09:41 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
"Gert" <Gert.VandeWouwerNO @ SPAM.com> writes:

> I just played with and array of structures, each structure containing a
> (float) images.
> If i do
>
> SomeProc, psData[NumStruct].flIm[1:1000]
>
> or
>
> SomeProc, (psData[NumStruct].flIm)[1:1000]
>
> then the result is the same, but the second runs much slower. Anyone knows
> why this is so? My guess is that in the second run, a copy of the array is
> made.

Yes, the parentheses are creating a temporary copy to be
subscripted, I think.

> I would be interested to find out if there are more 'pitfalls' out there.

Oh, goodness. Then I would make a daily practice out of
consulting this newsgroup. You will be surprised what you
learn. :-)

Here are some examples:

http://www.dfanning.com/code_tips/asterisk.html
http://www.dfanning.com/code_tips/slowloops.html
http://www.dfanning.com/tips/forloops.html
http://www.dfanning.com/tips/forloops2
http://www.dfanning.com/ographics_tips/slowrendering.html

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Beginer question about the @ usage
Next Topic: Widget_draw coordinates?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:17:43 PDT 2025

Total time taken to generate the page: 0.00566 seconds