Re: Returning values from a function
From: E. Robert Tisdale (E.Robert.Tisdale_at_jpl.nasa.gov)
Date: 10/21/03
- Next message: xarax: "Re: structures compatibility"
- Previous message: Richard Heathfield: "Re: slightly OT: error handling conventions"
- In reply to: jeffc: "Re: Returning values from a function"
- Next in thread: jeffc: "Re: Returning values from a function"
- Reply: jeffc: "Re: Returning values from a function"
- Reply: Martijn Lievaart: "Re: Returning values from a function"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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: xarax: "Re: structures compatibility"
- Previous message: Richard Heathfield: "Re: slightly OT: error handling conventions"
- In reply to: jeffc: "Re: Returning values from a function"
- Next in thread: jeffc: "Re: Returning values from a function"
- Reply: jeffc: "Re: Returning values from a function"
- Reply: Martijn Lievaart: "Re: Returning values from a function"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|