[CHALLENGE] finding rightmost zero bit



OK folks, time for a new challenge...

My profiler tells me that findpos(n) is a function which my code
seems to be using. The function looks like:

function findpos(n) result (pos)

integer(kind=i4b), intent(in) :: n
integer(kind=i4b) :: pos

... do your private stuff here ...

end function findpos

and its purpose is to find the index of the rightmost zero bit in the
base 2 representation of a number n. The least significant bit has
position 1.

The exact `Mission' of the challenge and a template-file can be
found at

http://www.cs.kuleuven.ac.be/~bartv/stuff/time_findpos.f95

I have three versions, and which one wins seems to depend a bit
on compiler and architecture...

bartv@vonneumann:~/fortran$ ./time_findpos
huge(n) is 2147483647.
Enter first number: 1
Enter last number: 147483647
Bart1's method did it from 1 to 147483647 in 1.69 seconds.
Bart2's method did it from 1 to 147483647 in 1.79 seconds.
Bart3's method did it from 1 to 147483647 in 1.72 seconds.

I think these are already quite fast and can probably not be speed up quite
a lot, but this newsgroup has learned me that i should *never* think my
routines can't be speeded up anymore... so amaze me, and be faster! :-)

Challenge ends this sunday at 23h59 your local time :-)

Regards,
Bart

--
"Share what you know. Learn what you don't."
.



Relevant Pages

  • Re: LEN_TRIM performance issue
    ... A long time ago in a Fortran 66 execution profiler ... it) was called FETE, Fortran Execution Time Estimator. ... out to be input to the compiler. ...
    (comp.lang.fortran)
  • Re: Returning values from a function
    ... > Shop around for a better optimizing compiler second. ... Or is disk I/O the bottleneck? ... you cannot tell without a profiler, but I found that fairly simple ... I've seen to often that optimization options introduce compiler bugs to ...
    (comp.lang.c)
  • Re: Returning values from a function
    ... > Shop around for a better optimizing compiler second. ... Or is disk I/O the bottleneck? ... you cannot tell without a profiler, but I found that fairly simple ... I've seen to often that optimization options introduce compiler bugs to ...
    (alt.comp.lang.learn.c-cpp)
  • Re: Encouraging programming on OpenVMS?
    ... Remember that the VMS compiler people were sold as slaves to Intel ... Further, since when was LSE ... > and DECset maintenance was outsourced to EDS some years ago. ... Yes, some of the folks that were sold to Intel were smart, ...
    (comp.os.vms)
  • Re: profiler
    ... I do not think there is a profiler for the Meridian Mac OS 6.x Ada 83 ... I think the profiler on the xyz compiler for the pqr OS is not Y2k ...
    (comp.lang.ada)