Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Ternary vs. Sort vs. Max

by Tux (Abbot)
on Aug 10, 2015 at 09:44 UTC ( #1137988=note: print w/replies, xml ) Need Help??


in reply to Ternary vs. Sort vs. Max

I personally prefer the ternary as it involves no overhead of extra scopes, loading modules and/or function calls: it is fast, obvious and clear (at least if you are acquainted with ternary syntax).

Your worry about duplicating the value is only important if the implementation of ternary is such that it actually invokes the FETCH on the variable twice (in any language), which can be problematic is the value is overloaded and does magic on fetch.

Calling sort could suffer the same, depending on the implementation.


Enjoy, Have FUN! H.Merijn

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2021-01-17 13:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?