Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^4: Detecting whether UV fits into an NV

by syphilis (Bishop)
on Mar 04, 2020 at 04:07 UTC ( #11113747=note: print w/replies, xml ) Need Help??


in reply to Re^3: Detecting whether UV fits into an NV
in thread Detecting whether UV fits into an NV

Moving the for loop into C space does enable the improvement in speed (about 12%) offered by uv_fits_double_ctz to become visible.

On my Windows 7 machine, perl-5.30.0, that improvement equates to the saving of 0.05 seconds in the processing of 12 million integer values.
That makes it somewhat less compelling, but a saving is a saving, and I would therefore be in favour of that approach, as opposed to the approach that I took.
I found that cutting the table size in half (by removing all zero entries) didn't measurably slow down uv_fits_double_ctz, in which we simply change the condition:
arg >>= ctz_table_11bit[arg & 2047]; to if(!(arg & 1)) arg >>= ctz_table_11bit[(arg & 2047) / 2];
I think I'd prefer using that reduced table (simply because it's half the size), though the altered line of code is perhaps not so readily intelligible.
The table could of course be further reduced in size, but I found that doing so started to impact on the performance.

Also note that uv_fits_double3 as presented here enters an infinite loop if given zero as an argument

Probably worth keeping in mind ;-)

I'll now take a look at the contribution provided by roboticus, as you've suggested.
I haven't had a chance to get to it earlier.

Thanks for the ideas and corrections !!

Cheers,
Rob

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11113747]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2020-06-05 19:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you really want to know if there is extraterrestrial life?



    Results (40 votes). Check out past polls.

    Notices?