in reply to Re^2: Newbie question
in thread Newbie question

Talk of optimization is premature?

Replies are listed 'Best First'.
Re^4: Newbie question
by Marshall (Canon) on Aug 23, 2022 at 15:48 UTC
    What I was trying to say is that the easiest to "code and understand" way is also likely to be the fastest way. And I was encouraging that. It really doesn't matter how good/bad the detailed implementation of abs() is, the time to execute the worst imaginable implementation is likely faster than making decisions about default behavior in light of an exception (the '-') and also suppressing normal exception behavior. I also suspect that either choice is completely dwarfed by the by the split operation and creation of the list of individual numbers.

    I don't think any benchmarking or further optimization is warranted here. I vote for the easy to understand way.