Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re: Efficiency and overhead of subs

by orkysoft (Friar)
on Nov 16, 2001 at 21:05 UTC ( #125854=note: print w/replies, xml ) Need Help??

in reply to Efficiency and overhead of subs

I think you're asking the wrong question.

Don't ask, 'How long does the computer take to run this program?'. Ask: 'How long do I take to write this program?'.

You'll probably save hours of time and lots of coffee by writing the program in such a way that it's easier to maintain. Do a million milliseconds spent executing the program a million time really weigh up against the hours (one hour equals 3.6e+6 milliseconds) saved by writing it in an easier-to-maintain way, using subs?

Besides, if you're still more concerned about CPU efficiency as opposed to programmer efficiency, you'd better stick to C :-)

Replies are listed 'Best First'.
Re: Re: Efficiency and overhead of subs
by Purdy (Hermit) on Nov 16, 2001 at 21:44 UTC
    I'm not sure I would agree with this (throwing a bone in here to start another discussion). While I agree that one of the purposes of developing a program is to create it as lazily/quickly, readable/maintable as possible, a bigger purpose is to serve the end user of the program. While we're talking about microseconds, they can add up under exponential usage (such as IMDB using mod_perl instead of CGI scripts) and if the user can appreciate faster response times, I'm for taking more development time and serving that purpose.

    My argument only holds up in those special cases, though, where the usage is enormous - so I'd answer the original pos(t)er of the question with "It Depends" (the quintessential answer of Consultants everywhere ;)) and it depends on the usage of the program.

    And if you're talking about a totally different dev environment (C, Assembly, etc), where I'm not proficient in and would take significant research/dev to get proficient, Perl's good 'nuf for me (so that would be another exception to my argument ;)).


      I totally agree that it depends..Let me tell you why.

      I just finished a project that took a process that someone was doing by hand (going to a web site through a series of pages, copy, paste into excel...blah, blah) which took roughly 3-5 hours a day, and streamlined it down to a couple hundred lines of code that is a click-and-walk-away process of about 20-30 minutes. That's a savings on the order of 1x103% improvement in time.

      Now I could probably shave another 5-10% off of the remainder if I wanted to implement fork() in this windows2k world here in my office, but frankly, considering what they already have, I doubt the end-user is going to notice those last 2 minutes, and the headache wasn't worth it.

      When it comes to implementation, YMMV. Work where you're comfortable, and determine your trade-offs. re - Time and Effort vs. Return.

      Just my US$0.02 worth.


Log In?

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2019-12-06 20:15 GMT
Find Nodes?
    Voting Booth?
    Strict and warnings: which comes first?

    Results (159 votes). Check out past polls.