Re: Returning values from a function

From: E. Robert Tisdale (E.Robert.Tisdale_at_jpl.nasa.gov)
Date: 10/21/03

  • Next message: Jeremy Yallop: "Re: Returning values from a function"
    Date: Tue, 21 Oct 2003 11:14:12 -0700
    
    

    jeffc wrote:

    > Karl Heinz Buchegger wrote:
    >
    >>>My question now is which of these solutions would be more efficient?
    >>>Or is this compiler dependent and considered OT?
    >>>(Don't wanna be flamed)
    >>
    >>Sorry. Can't resist.
    >>Why is it that newbies who are barely able to write a correct
    >>program always care about efficiency.
    >>To say it clearly: Forget about efficiency for now at this level.
    >>Write your program correctly, make it work.
    >>Then watch your program. If it is fast enough: don't do anything.
    >
    > I can't totally abide by that advice.
    > In fact, I think you've got it backwards to a certain extent!

    No. Karl gives sound advice here.

    > It's professionals who need to worry about efficiency
    > by finding bottlenecks when and if there are performance problems.

    Professional programmers look first for evidence that
    there actually is a performance problem.
    They run a profiler to find the "bottlenecks",
    and fix the worst ones first.
    They stop when performance is satisfactory.

    > What programs "at this level" are ever too slow?
    > Unless there's an infinite loop,
    > these programs are over practically by the time you hit ENTER.

    Then you don't have a performance problem, do you?

    > At this point, he's *learning* about efficiency
    > so he has some knowledge to make that call later.
    > I seriously doubt he's interested in speeding up a throwaway program.

    Premature optimization is a sin.
    Write code that is easy to read, understand and maintain.
    Exhaust your compiler's optimization options first.
    Shop around for a better optimizing compiler second.
    Only then should you run your profiler
    and consider cobbling your code to make it run faster.


  • Next message: Jeremy Yallop: "Re: Returning values from a function"

    Relevant Pages

    • Re: Returning values from a function
      ... > by finding bottlenecks when and if there are performance problems. ... They run a profiler to find the "bottlenecks", ... Then you don't have a performance problem, ... Exhaust your compiler's optimization options first. ...
      (comp.lang.c)
    • Re: Check box checking & application loads slow
      ... Regarding the performance problem at the client's site, ... SQL SELECT Optimization Levels and Performance ... >>dev PC and doesn't happen all the time on that one client PC. ... > can ghost images to it for any os I want for testing purposes. ...
      (microsoft.public.fox.programmer.exchange)
    • Re: How does directx work - World or View transforms and rotations
      ... MSDN) i set the view to identity matrix and have a camera matrix that ... This is a premature optimization. ...
      (microsoft.public.win32.programmer.directx.managed)