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

Re^2: CPU cycles DO NOT MATTER!

by dragonchild (Archbishop)
on Apr 17, 2008 at 15:57 UTC ( #681210=note: print w/replies, xml ) Need Help??


in reply to Re: CPU cycles DO NOT MATTER!
in thread CPU cycles DO NOT MATTER!

It does not matter how inefficient the code you write is. It is not necessary to understand the complexities of algorithms, data structures, profiling, or benchmarking. It is only important to write code as fast as possible that does the job because CPU time is less expensive.

Yes, that is exactly what I'm saying as a rule of thumb.

My mother-in-law writes small programs in VBA for Word and Excel as well as for Crystal Reports. This is as part of her job as a purchasing agent. Which is more important for her - to write code that runs efficiently enough or for her to understand all the algorithms that we, as professional developers, need to know? I would argue that she just needs to do her job. If the code she writes would strike one of us blind, but it runs fast enough on the machines she is given, then what's wrong with that?

The idea that code needs to be perfect is, itself, dogma. We, as the professionals, need to remember that the majority of all code is now not written by a professional programmer nor is it being written in an enterprise-grade language. It's being written in VBA, Lotus's macro language, and similar tools by business analysts, bankers, and stay-at-home moms. For them, algorithms would just get in the way.

Why is this important for us? Well, I know that roughly half of all my work tends to be stuff that can take 10x as long to run and still be fine. For that stuff, runtime efficiency is inefficient.


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?

Replies are listed 'Best First'.
Re^3: CPU cycles DO NOT MATTER!
by Limbic~Region (Chancellor) on Apr 17, 2008 at 17:00 UTC
    dragonchild,
    Hrm - let me try again then.

    It never matters how inefficient the code anyone writes is. It is never necessary to understand the complexities of algorithms, data structures, profiling, or benchmarking. All anyone needs to do is write code as fast as possible that functions correctly. It is never important to ensure your code scales because CPUs are getting faster than everyone's data is getting larger.

    I have already agreed with your sentiment and am not arguing that you are wrong. I am pointing out that what you have said may not come across as a rule of thumb to everyone. In fact, the way you have bolded it, upper cased it, and followed it with an exclamation point - you have made it seem like there is no room for discussion. If you take your argument to one possible logical conclusion, it becomes ridiculous.

    "You're using Perl because it's at that sweet spot between simple and expressive

    That is a bad starting assumption. Why don't you come hang out in #perl on freenode some night. There is no end to the number of people using perl (and PHP) because they do not seem to be competent enough to learn any other language. The task at hand may already be borderline at best for being done in perl. Throw in inexperience and lack of knowledge and it will never accomplish the goal - no matter how long you let the CPU spin.

    Cheers - L~R

      Never use absolutes, my friend. Never ever. :-)

      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?
      "There is no end to the number of people using perl (and PHP) because they do not seem to be competent enough to learn any other language."

      Hey! I resemble that remark.

      You brought up the point I wanted to address, though. The original post assumes that you know every programming language and they're all available for the project, but you chose Perl. I could theoretically program a CGI script in assembly, but 1: I don't know assembly, and 2: It'd be a little difficult to find a host that allows it.

Re^3: CPU cycles DO NOT MATTER!
by sundialsvc4 (Abbot) on Apr 18, 2008 at 20:56 UTC

    Unfortunately, this “rule of thumb” of yours only applies when the task in question is on-the-order-of what your mother-in-law (i.e. a human being) deals with.

    The fundamental fallacy of your argument rests in the fact that nearly all of the “hard” problems that a business-oriented computer must deal with are I/O-bound, not CPU-bound. Therefore, the justification that “CPU time is less expensive” becomes entirely specious since “the CPU” is barely even used.

    The ruling constraint (to the hardware) is ... always is ... I/O and nothing else. Any strategy must necessarily focus upon the reasonably-efficient utilization of that resource, at least insofar as the entire computer-system is concerned.

    The goal therefore must be to devote “only a reasonable amount of frighteningly-expensive human time” toward a strategy that efficiently avoids the hardware-constraint of I/O, even at the expense of (generally quite throw-away...) CPU resources.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (7)
As of 2021-06-21 10:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)












    Results (98 votes). Check out past polls.

    Notices?