http://www.perlmonks.org?node_id=681210


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?