Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^5: 5x6-bit values into/out of a 32-bit word

by grinder (Bishop)
on Mar 18, 2007 at 17:37 UTC ( [id://605371]=note: print w/replies, xml ) Need Help??


in reply to Re^4: 5x6-bit values into/out of a 32-bit word
in thread 5x6-bit values into/out of a 32-bit word

In Perl, of course, the difference would not be worth mentioning, but in C, my unrolled-loop version is much faster than a version with a loop.

Yes, but this is Perl we are talking about, a language where a cosine is really no more expensive than an addition, not C. Perl is about flexibility, C is about speed.

if we are using a lot of them, probably millions

If you have millions of them, then Perl is the wrong language to use.

All I know is that seeing those multiples of 6 raises a red flag, at least as far as Perl is concerned. That code strikes me as fragile, in that it does not adapt to changing requirements readily (which is one of the reasons I code in Perl). Remember the cardinal virtue of Laziness.

Also, while I don't know why BrowserUK wants to do this, I maintain my reasoning is as valid as yours. There are dozens of ways of packing small bitmaps into a 32-bit quantity, and far more can be packed into a 64-bit quantity, as 64-bit CPUs become more prevalent.

• another intruder with the mooring in the heart of the Perl

  • Comment on Re^5: 5x6-bit values into/out of a 32-bit word

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (2)
As of 2024-04-26 05:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found