Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Programmers Nostrums

by ambrus (Abbot)
on Nov 24, 2009 at 21:46 UTC ( #809212=note: print w/ replies, xml ) Need Help??


in reply to Programmers Nostrums

Use a table, even if most of the entries are the same/empty, it makes your logic simpler and computers like them (remember this was when you sweated over every byte your code used).

No, that was back when the CPU would run on the same frequency as the RAM so you didn't have to think about caching. Nowadays looking up something in a large table can be expensive because accessing RAM is slow, but on the other hand conditional jumps can be expensive too because of prefetching and decoding, so figuring out what takes more time is much more complicated. (But at least there's still good documentation (eg.) so if you really take the time to RTFM then you can make an educated guess.)


Comment on Re: Programmers Nostrums

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (2)
As of 2014-09-20 02:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (151 votes), past polls