Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

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

by grinder (Bishop)
on Mar 18, 2007 at 17:37 UTC ( #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?

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (7)
As of 2018-10-19 21:48 GMT
Find Nodes?
    Voting Booth?
    When I need money for a bigger acquisition, I usually ...

    Results (111 votes). Check out past polls.