Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Let's look at your requirements:
  • bug free: this has nothing to do with efficiency. A program which is not bug free, is just wrong. Of course for any but very simple programs you cannot be sure that there are no bugs lurking inside.
  • less time and memory use: These may be conflicting requrements. Perl easily trades memory for speed and with memory being cheap this is an acceptable trade-off. Now, neither speed nor memory use as such are matters to be too worried about. For example a script written for a one time task: I can make it run faster by 50% by reviewing the code and spending one hour of work. Is it worth the bother if it speeds-up the script from 1 minute to 30 seconds? Even big, repetitively run programs may be scheduled during night time and nobody will care if they take "too" long, as long as their job is done when the results are due.

    The same arguments go for memory consumption. Squeezing the last byte out of a memory structure may not be worth it. It all depends on what is required of it.

  • Easily understandable: if you mean by that "easy to maintain", I fully agree. But that is the most difficult part. Shy away from "too clever" constructs, use well tried and/or standard modules, comments and documentation are of course required and a full test suite (best written before you start to code) is a must.

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James


In reply to Re: Efficient programming by CountZero
in thread Efficient programming by perlthirst

Title:
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 How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2024-04-20 01:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found