Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^4: Detecting whether UV fits into an NV

by syphilis (Archbishop)
on Mar 04, 2020 at 04:07 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11113747]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2024-04-25 10:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found