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

Home » Public Forums » archive » Compiling file with many functions: huge performance difference between IDL and IDLDE
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: Compiling file with many functions: huge performance difference between IDL and IDLDE [message #38647 is a reply to message #38531] Thu, 18 March 2004 12:36 Go to previous messageGo to previous message
Sidney Cadot is currently offline  Sidney Cadot
Messages: 7
Registered: October 2002
Junior Member
Andrew Cool wrote:

> OK, me dumb bunny - me no know what a string based map is.
> But based on your example above, how about this?
>
> map_array = Strarr(12000,2)
>
> map_array(0,1) = string(indgen(12000),form='(i5.5)')
> map_array(5000,0) ='dick'
>
> t = Systime(1)
> found_index = Where(map_array(*,0) EQ 'dick')
> print,'Time taken = ',Systime(1) - t,' seconds'
> print,'Found Index = ',found_index
> ret_value = map_array(found_index,1)
> print,'Returned Value = ',ret_value

This uses a linear search. This is a lot slower than IDL's internal
hashing, which is basically O(1).

> Now on my PC, Time taken = 0.00000000 seconds,
> which I'd call pretty close to "optiomal".

Try calling it a million times and compare it to my solution; you will
see a significant difference.

> Do you really need 12000 function definitions?

I have yet to see a better solution.

Best regards,

Sidney
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: image registration, robust
Next Topic: compiling itools and utilities

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

Current Time: Wed Oct 08 18:04:10 PDT 2025

Total time taken to generate the page: 0.00471 seconds