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

Home » Public Forums » archive » Re: speed of n_elements
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: speed of n_elements [message #17643] Thu, 04 November 1999 00:00 Go to previous message
R.Bauer is currently offline  R.Bauer
Messages: 1424
Registered: November 1998
Senior Member
Pavel Romashkin wrote:

>> * I can't repeat your experience on Sun or Linux. On both those
>> machines n_elements(data.flag) is much slower than n_elements(data),
>> at least in a loop.
>
> Thank you for the test, Craig. I repeated it and n_elements(data) was way
> faster. But I was certain that I saw what i saw, so I reconstructed the
> entire data system in the same way it was in my program. DATA in my program
> is itself passed as a field of State structure inside a widget tree. Try the
> following code:
> **************
> pro test, a
>
> start=systime(1)
> for i=0, 100 do temp = n_elements(a.data)
> print, systime(1)-start
>
> start=systime(1)
> for i=0, 100 do temp = n_elements(a.data.flag)
> print, systime(1)-start
>
> end

Hi

This example is 100 times faster.

R.Bauer


pro test, a

start=systime(1)
c=a.data ; changed !!
for i=0, 100 do temp = n_elements(c)
print, systime(1)-start

start=systime(1)
for i=0, 100 do temp = n_elements(a.data.flag)
print, systime(1)-start

end
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: idl emacs question
Next Topic: CGM files into PC Word for Windows

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

Current Time: Fri Oct 10 10:22:33 PDT 2025

Total time taken to generate the page: 0.96015 seconds