Path: utzoo!attcan!uunet!peregrine!elroy!ames!pasteur!ucbvax!hplabs!hp-pcd!hplsla!jima From: jima@hplsla.HP.COM (Jim Adcock) Newsgroups: comp.lang.c++ Subject: Re: Assembly or .... Message-ID: <6590074@hplsla.HP.COM> Date: 28 Nov 88 19:00:48 GMT References: <1388@aucs.UUCP> Organization: HP Lake Stevens, WA Lines: 32 > >I don't agree that there is ever any necessity to code in assembler. We > >have languages that produce code just as good as hand crafted assembler > >(such as C), so why not use them for this sort of thing. > > Ah, but wouldn't that be nice. Optimizing compilers that could generate > code as good as we can generate by hand in all cases. Let me know when > someone writes one. Well, I have seen optimizing compilers that generate code as good as can be coded by hand when:-) 1) The person writing the C code knows C. 2) The person writing the C code know the capabilities and limitations of his/her optimizing compiler. IE you know what assembly it's going to generate. 3) The person writing the C code know the capabilites and limitations of the underlying hardware. Now a good way to learn #3 is to learn the associated assembly. But disc drives, buffering schemes, paging algorithms, etc also have a major affect on the performance of a particular algorithm, and reading assembly manuals won't help you there. My experience is that people writing in HLL who haven't studied CPUs, assembly, etc, write code that executes about 100X slower than people who have studied these issues, and who have some idea of the kind of assembly their HLL coding will generate. People who haven't studied CPUs, assembly, etc, seem to assume that "optimizing" compilers implement the God function -- "guess what it is that I want you to do, then figure out an efficient way to do it for me." And Oh by the way, fix any mistakes that I made for me.