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

Re: Zero... THANKS Pavel and J.D.



Pavel and J.D.,

Thanks to both of you for some useful information.

Pavel mentioned the 0-at-the-end problem with the loop approach.  After some
analysis of my problem (a directed graph search), I've discovered that most
of the vectors I search will contain a non-zero within the first 10% or so
of the length.   I would have thought then that the loop would be faster
than 'where' but J.D.'s timing results prove me wrong - looks like even with
loop halt at 10% (where his test halted at 50%), the timing would be 0.99/5
= 0.2, still twice the time of 'where' searching the whole vector - boy, IDL
loops really are bad!

For now I'm settling on 'where' - it's just fast enough for the biggest
graphs I'm searching so far.  J.D.'s timing for external code indicates that
with 10% lengths typical, I might get 10X speedup over 'where' but for now
the DLL compilation isn't worth it.  But it gives me an out if I need to
search bigger graphs.

Incedentally, I'd never realized you can say (where())[0] to get that first
element - that's a handy statement.

Thaks,
Frank