Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^2: Challenge: CPU-optimized byte-wise or-equals (for a meter of beer)

by moritz (Cardinal)
on Sep 12, 2007 at 14:50 UTC ( [id://638583]=note: print w/replies, xml ) Need Help??


in reply to Re: Challenge: CPU-optimized byte-wise or-equals (for a meter of beer)
in thread Challenge: CPU-optimized byte-wise or-equals (for a meter of beer)

Since there are not so many bytes to substitute it pays off to search for these rare cases instead of working "blindly" with bit ops.

Creating $mask takes one pass through the string, and then there are three binary bit ops on the string(s). That makes four passes, while only 1/256 of the bytes being zero bytes.

Thus a solution that actually looks for zeros (one pass) may have an overhead of 3*256 compared to the bit operations to be still as fast. (Rough estimation only)

  • Comment on Re^2: Challenge: CPU-optimized byte-wise or-equals (for a meter of beer)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://638583]
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: (2)
As of 2024-04-19 21:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found