Re: A89: Re: "Transfer" of values between C and ASM


[Prev][Next][Index][Thread]

Re: A89: Re: "Transfer" of values between C and ASM




}InFuZeD{ wrote:
> 
> Ummm....No they cant =P 

Ummm?  You sound unsure.  You should be unsure, since a good C programmer can
tweak their program to compile to the same optomized asm code an assembler would
produce.  Hello, let's think about this for a minute.  You know that C compiles
to assembly, which is then assembled to machine code.  With a good two or even
three pass compiler, made by those who know the processor inside and out, the
assembly produced by the compiler rivals that which is hand produced.  There is
only a finite amount of tweaking which can be done to a program produced in
assembly, and a good compiler used by a good programmer will produce code that
is that good.

> Note that C is a "High Level" language and that Asm
> is a "Low Level" language =P 

So noted.  It is a common misconception that all high level languages are
inefficient and bloated.  Of course, that is the same as saying "All
generalities are false (Including this one)"  Please don't generalize.

> You'd have to modify your C program ALOT w/
> bits of asm code to make it run as fast. 

That is not correct as long as you have a good programmer and a good compiler. 
Secondly, you would not have to modify it "ALOT".  A decent programmer with a
decent compiler will produce code where, while not efficient, and perhaps a
teeny bit bloated, there would be little or no speed difference between it and
asm code(to the user, on a 10MHz 68k).  Except, of course, the time it took to
develop that program.

> I'm not talking about on the
> computer because computers are fast enough either way not to really show
> much difference. 

Ok, so what you are saying is that the 68k processor is not a 'computer'??? 
Please enlighten me as to your definition of 'computer'.  I suppose you mean
modern computers which run at 400+MHz.  Only 40 times faster than our calc, I
might add.

> The fact is that Asm programs are faster then those coded
> in C (if the asm programmer knows what he's doing =)

Sorry, that is not a fact.  It is a generality.  Given two decent programmers,
one programming in assembly, the other in C, both using free programming
utilities on a familiar platform, the program from the first will be slightly
smaller, and slightly faster.  The second programmer will spend at least half as
much time coding and debugging.

Of course, given two great programmers, each using professional development
tools, and each tweaking for maximum effect, the output will be exactly the
same... But the ASM programmer will still have spent twice as much time as the C
programmer.  But then we're talking about programming tools in the 1-20 grand
price range.  Everything is a trade off.

> 
> -'FuZeD

I do not mean to sound like a jerk, but I program professionally, as well as a
hobbyist on both computers and embedded systems.  A good one, not a great one. 
If there were a clear advantage to using ASM to make my programs, I would be
doing it.  The slight performance decrease in programs which I do not tweak is
worth the gained time.  I can see though, that for those for whom it is a hobby,
it is thrilling to gain that slight increase - at the cost of time.  For a
hobbyist, time is not directly proportional to money.

-Adam

P.S.  Now here's the funny part - I know C and C++, and would rather program in
it, but, get this - My employer has me program in Visual Basic.  His reasoning? 
The development cycle is faster, and he and the other embedded engineers can
program it themselves if need be.  <sigh>  (that's one tradeoff I would rather
not make... But hey, They tell me what to do, I get a paycheck.  It's pretty
simple...)


References: