Related articles |
---|
Why is compiled basic slower than C? (Basic is the future) Glenn_Johansson@f313.n203.z2.fidonet.cd.chalmers.s (1992-08-11) |
Re: Why is compiled basic slower than C? (Basic is the future) jch@rdg.dec.com (1992-08-12) |
Re: Why is compiled basic slower than C? (Basic is the future) hywang@apple.com (Hao-yang Wang) (1992-08-12) |
Re: Why is compiled basic slower than C? (Basic is the future) maniattb@cs.rpi.edu (1992-08-12) |
Re: Why is compiled basic slower than C? (Basic is the future) macrakis@osf.org (1992-08-12) |
Re: Why is compiled basic slower than C? (Basic is the future) scott@bbx.basis.com (1992-08-13) |
Re: Why is compiled basic slower than C? (Basic is the future) macrakis@osf.org (1992-08-14) |
Re: Why is compiled basic slower than C? (Basic is the future) burley@geech.gnu.ai.mit.edu (1992-08-14) |
[9 later articles] |
Newsgroups: | comp.compilers,comp.lang.basic |
From: | jch@rdg.dec.com (John Haxby) |
Organization: | Digital Equipment Corporation |
Date: | Wed, 12 Aug 1992 08:43:32 GMT |
References: | 92-08-042 |
Keywords: | Basic, C, performance |
Glenn_Johansson@f313.n203.z2.fidonet.cd.chalmers.se writes:
|> [How much slower is compiled Basic than C, and why?]
There has been a lot of work put into optimizing C compilers: the efforts
of FSF, Sun and MIPSCO to mention but three. There hasn't been a great
deal of work put into optimizing BASIC compilers, at least not that I know
of.
There seems to be a more general problem though: compilers of high-level
languages tends to produce optimal machine code, whereas compilers of
low-level languages tend to produce sub-optimal machine code.
Some time ago, code produced by an Algol68S compiler was compared to code
produced by an optimizing Fortran compiler on an ICL1906. The program
compiled from Algol68 ran 30% faster than that produced from the Fortran
compiler. The reason for this seems to be that the high-level language
compiler has a better idea of what the programmer is trying to do and can
make appropriate optimizations-- such optimizations frequently show up as
doing nothing at all where another programming language would require code
to be executed, or use a single machine instruction for coping where (C
for example), would use a loop. This form of optimization, of course, is
largely wasted on RISC machines, although the compiler can still exercise
the right to copy, say, 4 bytes at a time whereas the C program forces a
byte by byte copy.
--
John Haxby
Digital <jch@rdg.dec.com>
Reading, England <...!uknet!wessex!jch>
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.