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 autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,b87849933931bc93 X-Google-Attributes: gid103376,public X-Google-Thread: f43e6,b87849933931bc93 X-Google-Attributes: gidf43e6,public X-Google-Thread: 1108a1,b87849933931bc93 X-Google-Attributes: gid1108a1,public X-Google-Thread: fac41,b87849933931bc93 X-Google-Attributes: gidfac41,public From: Richie Bielak Subject: Assembler most efficient??? (was Re: What is wrong with OO ?) Date: 1997/01/10 Message-ID: <32D6C18B.30A8@calfp.com>#1/1 X-Deja-AN: 209026484 x-nntp-posting-host: host022.nyc.interactive.net references: <5a0niaINNlda@topdog.cs.umbc.edu> <32C43AC8.24E2@sn.no> <32C557F6.532C@rase.com> <5aa0eo$thd@krusty.irvine.com> <5aadbr$ad8@masters0.InterNex.Net> <32D64433.41C6@wi.leidenuniv.nl> x-nntp-posting-user: (Unauthenticated) content-type: text/plain; charset=us-ascii x-trace: 852935105/8560 organization: IBS Interactive, Inc. mime-version: 1.0 newsgroups: comp.lang.eiffel,comp.lang.ada,comp.object,comp.software-eng x-mailer: Mozilla 3.0Gold (X11; I; SunOS 5.4 sun4m) Date: 1997-01-10T00:00:00+00:00 List-Id: Robert Dewar wrote: > > "> Assembler will ALWAYS be the most efficient language. The more you > > abstract the problem, the more you "generalize" the solution to a > > given problem, the more you necessarily give up in efficiency. C > > takes a minimal 3x hit on integer arithmetic, 10x on more complex > > stuff; and OO, because of the overhead interpreting where > > to send things, is 10x on top of that." > > First, it is only true that assembler is most efficient if written by > a competent programmer. Since well over 90% of the assembly language > that I have seen is highly incompetent, this is an important criterion. > In particular, I often see the phenomenon of super ferocious, super > tight coding of junk algorithms, and the result can easily be beaten > by a decent algorithm written in any language. > [...] I agree with Robert 100%. In John Bentley's book "Programming Pearls" there is a neat example of this. He shows a program written in BASIC on a TRS-80 and a program written in FORTRAN on a Cray. The BASIC program used a linear algorithm and the FORTRAN program used a quadratic algorithm to solve the same problem. When the size of problem got to about 10,000 the TRS-80 beat the Cray. Part of the difficulty compilers have with generating good code is that CPUs are being designed by people who coded in assembler and never had to write a compiler. Niklaus Wirth's Lilith computer was an example of a CPU designed with a compiler in mind. He has written a bunch of articles comparing the performance of his Modula-2 compilers on Lilith and the MC68000 (see past issues of CACM - about 10 years ago?). The Lilith outperformed most computers in its class and it didn't have an assembler. Compilers can be much smarter than programmers in generating machine code, especially on some of these pipe-lined RISC CPUs. ...richie * richieb@netlabs.net - at home | Richie Bielak * * richieb@calfp.com - at work | * * Home page: http://www.netlabs.net/hp/richieb * * "Fight software piracy, use free software!" (me) *