#Opening Screens Quietly
8 messages in this thread
I keep hearing these references that assembly is somehow magically better than
a higher level language; I must take exception to that. If one has a good
optimized compiler, than studies have shown that it will produce as good or
better code than the average assembler. Given the productivity of HLLs and
ease of maintainance, it seems to me that it is a win over assembler, EXCEPT in
small critical areas where assembler modules could be used. I speak from
experience when I say this, since the computer system I work on was written in
over 95% PL/I with only 5% in assembler. You wouldn;t believe how much easier
it is to write code for, debug and amie dm maintain compared to other systems.
The comparative man-hour estimates for this system is amazing. The key is the
compiler. If it is not truly optimized, than you will suffer a noticable
performance degredation. But it seems to me that the solution is to than get a
better compiler, not to convert everything to assembler. Of course modular
writing makes things easier, no matter what language you're using. Think, if
assembler libraries make assembly programming easier, how much better
C/Assembler libraries will make C programming.
I would certainly be distressed, if the "let's go assembler" elements won on
this. Sorry for the flame…
John G. Ata
John,
I find your message a bit puzzling, in that you seem to think that in the
ongoing "language debate", there must be a "winner". That there can be no
winner should be obvious to anyone who has used more than one langauge.
The purpose of a language is to translate the programmer's thoughts to
something the computer can use to accomplish the task at hand, and whatever
language does that FOR ANY GIVEN PROGRAMMER, is by definition the "right"
language.
You speak of highly optimized compilers. For me the point is moot. If the
available compilers for the Amiga are not highly optimized, then I am right in
using assembler, which beats the compilers hands down in speed and size. If
they are highly optimized, then your "studies" are demonstrably false.
I find that loading up a couple of registers, calling a routine, and storing
the result is easier for me to understand than most C calls, and I don't have
to shove the entire universe onto the stack to do it.
While I agree that in a production environment, where software costs are the
most significant part of the DP budget, high level languages are preferable to
saving floor space or money for disk storage. In my case, my time is spent in
pursuit of a hobby, with no "chargeout" for my programming time, and I do not
begrudge the time spent on a worthwhile project nearly as much as I would
begrudge money spent on additional disk storage.
Regards, Larry.
I would be quite upset if HLLs won out in the language debate. C is the reason
why the amiga's 512K seems so small. All of these C programs almost (but not
quite) make me feeling like going back to the 8-bit world.
Chris (SubLOGIC)
Chris,
I reiterate… there is, and can be no "winner". All languages have their
place. This is fairly evident if you stop to think that _someone_ wrote the
language, and in doing so, wrote it to translate his own thoughts to machine
code. If it does that for him and nobody else, then it will not make it as a
general language. The fact that there are choices just goes to prove that all
programmers do not think alike, nor are all programming environments alike.
It pains me to have to try to translate C to assembler to find out what the
program is _really_ doing, and it also pains me to see bloated code produced by
C and other HLLs, but really, when you think about it, this machine might still
have been on the drawing board if it weren't for HLLs.
All people like you and I can do is to show what can be done with assembler,
and hope that the showing will cause more programmers to write in it.
Regards, Larry.
Not to be argumentative — but please name just ONE compiler, in any HLL,
that runs on the Amiga, which will produce code that is "as good as or better
than hand coded assembly."
John,
I also take exception to any inferences that assembly is "somehow magically
better than a higher level language"; I take exception to all hyperbole.
With that in mind, I would appreciate you pointing out where anyone has
actually said this, and what studies have shown that an HHL will produce code
"as good or better… than the average assembler". This is a blanket, and
nondescript, statement… define "better".
If you're going to throw virtual tomatoes at people who like assembly, then I
want to see your ammunition. 8)
Nybbles!
Rick,
The hard part is defining "average" assembly language. Having written
(and read) a lot of assembly code (for more chips than I want to think about) I
would describe 99% of the assembly code written as garbage. (Of course 99% of
hll code is also garbage. Just proves that there are a lot of programmers who
have never really "learned" to code.) If you take that garbage code it is
pretty easy for a hll to produce better (even with the current crop of hlls for
the Amiga). There are a lot of mini and main frame compilers that will usually
produce "better" code than a good assembly programmer when the program is
measured as a whole. A given had written asm routine may be better than a hll
routine, but the hll with a good optimizer will be consistently "good" where
the asm programmer will be brilliant in spots and so so in others. (Also a
good hll optimizer looks at more of the program at a time than a programmer
can. Just how much can you really focus on at once? A computer can "think"
about more.)
This doesn't mean that everyone should code in hlls. It just says that
for a lot of people they are better off in a hll than in asm. (This includes a
lot of people who think they are asm gurus.)
One of the reasons I work mostly in C is the fact that I know I can't
consistently write significantly better code than the compiler. In most cases
the gain (in size or speed or both) will be very small in comparison to the
amount of work it will take me. For those sections where the speed/size is
very important (eg. my text/line manipulations in PCE) then I take the time to
write a very small and fast asm routine. (Which I almost always first write in
C to debug the concept. The C routine may use a different algorithim that is
quick/easy to write since I know it will be redone later.)
Dan
I think that your average good assembly language coder produces better code
then a C compiler neraly all of the time (99.99%). If this wasn't true, the
size difference wouldn't be so large between C and assembly programs. Amiga
flight simulator code is around 50k. Certainly the vast majority of it isn't
carefully tuned cycle by cycle, but the instruction optimizations done by a
good programmer just as a matter of course beat those done by a compiler. If
you don't believe this, try packing all of the features into C code in less
than 50k. Even if you carefully optimize every line in C, you'll never do it.