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

Home » Public Forums » archive » counting bits
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: counting bits [message #34191 is a reply to message #34107] Thu, 20 February 2003 14:53 Go to previous message
Dick Jackson is currently offline  Dick Jackson
Messages: 347
Registered: August 1998
Senior Member
"JD Smith" <jdsmith@as.arizona.edu> wrote in message
news:pan.2003.02.20.15.43.26.137656.2731@as.arizona.edu...
> On Wed, 19 Feb 2003 08:47:31 -0700, Dick Jackson wrote:
>
>> IDL> CountingBits
>> IShft-AND-lookup method: 2.063 seconds. tot = 46137328
>> Byte-lookup method: 0.691 seconds. tot = 46137292
>>
>> Uh-oh... I set the Total calls to have /Double and then we both get
the
>> same (I hope correct) answer:
>>
>> IDL> CountingBits
>> IShft-AND-lookup method: 2.063 seconds. tot = 46137344
>> Byte-lookup method: 0.671 seconds. tot = 46137344
>
> That's very strange. Here's what I get for my four independent
> methods without any /DOUBLE:
>
> 3.4187140
> 46137344
> 6.9928349
> 46137344
> 1.2564960
> 46137344
> 1.2767580
> 46137344

In case anyone's still following this exercise, we found that if 'bits'
is a byte array (not integer) my floating-point problem goes away, and
makes it faster! Adding this after 'bits' is defined will do it:

bits = Byte(bits)

... and gives another nice speedup:

IDL> CountingBits
IShft-AND-lookup method: 1.883 seconds.
tot = 46137344
Byte-lookup method: 0.541 seconds.
tot = 46137344

Cheers,
--
-Dick

Dick Jackson / dick@d-jackson.com
D-Jackson Software Consulting / http://www.d-jackson.com
Calgary, Alberta, Canada / +1-403-242-7398 / Fax: 241-7392
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Envi Display Groups
Next Topic: IDL_MakeStruct: memory leak? (C / DLM question)

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

Current Time: Wed Oct 08 19:03:18 PDT 2025

Total time taken to generate the page: 0.00472 seconds