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

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Every so often, Perlmonks gets a SoPW asking "Which is faster, A or B?" Invariably, a whole bunch of benchmarks are done and, 99% of the time, the difference, if any, averages to about 3 microseconds. That's 3 millionths of a second. In other words, if you did the slower operation 330,000 times, it might take an extra second. might.

I cringe every time I read one of these nodes. In 99% of the cases, CPU cycles simply don't matter, and here's why:

  • You're using Perl because it's at that sweet spot between simple and expressive. Which means that you spend less time coding and more time . . . well, you spend less time coding.
  • More importantly, changes to your Perl code will, in general, take less time than with any other language and your changes will be safer.
  • CPUs double in speed every 18 months while the cost drops by half (Moore's Law).
  • The ability to write code, unfortunately, is subject to an inverse Moore's Law.
In other words, an hour of programmer time costs an employer between $80 and $100. This includes salary, benefits, legal costs, space, power, machines, etc. A new server costs, roughly, $8,000-$10,000 after you factor in power, sysadmin time, and cost. So, a new machine costs, roughly, 100 hours of programmer time.

Let that sink in. A new machine costs about two weeks of your time. Or, put another way, you are worth about 50 machines per year.

Anything you do needs to be measured in that light by the person paying you. Is it worth having my person spend 3 days here and 2 days there squeezing out performance? Or, is it worth just buying another machine and having my person actually spend time advancing my business? Because, there's an additional opportunity cost to squeezing performance cause you're not doing something else that actually makes money.

So, to recap - CPU cycles don't matter because the limiter isn't the CPU anymore - it's the programmer. Especially in a language like Perl.

My criteria for good software:
  1. Does it work?
  2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?

In reply to CPU cycles DO NOT MATTER! by dragonchild

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2021-06-17 08:00 GMT
Find Nodes?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)

    Results (83 votes). Check out past polls.