From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: * X-Spam-Status: No, score=1.3 required=5.0 tests=BAYES_00,INVALID_MSGID, MSGID_RANDY autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ef33c33c4f98bde1 X-Google-Attributes: gid103376,public From: Robert Dewar Subject: Re: Compiler for Z80/6510 Date: 1999/11/25 Message-ID: <81k67s$47l$1@nnrp1.deja.com>#1/1 X-Deja-AN: 552975898 References: <383c6fed.458467@news.fiam.net> X-Http-Proxy: 1.0 x34.deja.com:80 (Squid/1.1.22) for client 205.232.38.14 Organization: Deja.com - Before you buy. X-Article-Creation-Date: Thu Nov 25 20:29:51 1999 GMT X-MyDeja-Info: XMYDJUIDrobert_dewar Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.04 [en] (OS/2; I) Date: 1999-11-25T00:00:00+00:00 List-Id: In article , lutz@iks-jena.de (Lutz Donnerhacke) wrote: > The common experience is, that high level languages result in > slow and bloated code. But this must not be true. There is no > reason for such > compilers despite laziness of developers (it's an expensive > development). Actually this is very often the result of programmers who program in the high level language blissfully unaware of the consequences of what they write. It is common today (though worrisome to me) that people write in a language like Ada without even knowing machine code at all, let alone having a good idea of the relation of the source they write to the machine code being compiled for their particular machine. Certainly if you write Ada carefully using GNAT, you will get perfectly efficient code, suitable for use on small micro controllers if you do a GNAT port for such a device (perfectly practical for those microcontrollers with existing gcc ports). > For most modern processors hand written assembler will be > slower than a > compiler output. The complexity of scheduling and computation dependencies > can be handled by a human in hundreds of hours, but a compiler can do this > in a few seconds in respect to all possible optimization methods. This is conventional wisdom, but is quite wrong. An experienced assembly language programmer can still do better than any compiler. It is hard work, but in fact on machines that are the HARDEST to program by hand, e.g. the Intel i860, it is still the case that BLAS for standard matrix operations is far more efficient than any compiler generated code. True, most people cannot write efficient assembler language, for any machine. And what you say is of course true for them, but the idea that wonderful modern compilers can generate amazing code better than skilled humans can is just plain wrong. > You might produce a better code for a small time critical loop > but not overall. Well that depends on how much time and effort you spend! And of course small time critical loops are the only place where code quality matters for time. Now on micrcontrollers you are typically worried about space, and that of course is much worse, since the entire application has to be coded aggressively. I once wrote a full symbolic two pass assembler for a machine with advanced features like expression parsing and literal pool managaement for a 4K byte machine. THe entire assembler could assemble itself in the 4K bytes, which had to hold the entire code for the assembler (no overlays possible, no external disks), and the entire symbol table for the assembly (those were the days :-). The symbol table by the way contained about 600 symbols for this particular case. Sent via Deja.com http://www.deja.com/ Before you buy.