Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re2: Pair of items

by dragonchild (Archbishop)
on Jul 29, 2003 at 20:26 UTC ( [id://278973]=note: print w/replies, xml ) Need Help??


in reply to Re: Pair of items
in thread Pair of items

While faster, it is more prone to error should there be any change in requirements. It also needs a helluvalot of commenting so that your maintenance programmer(s) (which could very well be you!) don't make a well-meaning change and screw it up.

Like all optimizations, it should be done only if that section of code has been identified as a bottleneck through profiling. (Never use analysis as the only source of information when profiling. Using a profiler is the only way to truly know where your bottlenecks are.)

------
We are the carpenters and bricklayers of the Information Age.

Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.

Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.

Replies are listed 'Best First'.
Re: Pair of items
by tadman (Prior) on Jul 29, 2003 at 20:30 UTC
    I agree that it's awfully simplistic, but there are occasions, like bioinformatics, which might use a routine like this in some capacity. I've just given two different versions for comparision and discussion/argument and whatnot.

    I'd go for the hash based approach.

    However, even a function that's intentionally crippled like that can be made "safe" by naming it something like compare_triplets or what have you. You'd have to be pretty daring to feed a function like that anything but what's expected, though of course, even this precaution may not protect you from the inevitable.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (2)
As of 2024-04-20 03:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found