Newsgroups: comp.sys.acorn
Path: utzoo!utgpu!watserv1!watdragon!rose!ccplumb
From: ccplumb@rose.uwaterloo.ca (Colin Plumb)
Subject: Re: C,Pascal & BASIC
Message-ID: <1991Feb18.080958.16120@watdragon.waterloo.edu>
Sender: daemon@watdragon.waterloo.edu (Owner of Many System Processes)
Organization: University of Waterloo
References: <803@utrcu1.UUCP>
Date: Mon, 18 Feb 1991 08:09:58 GMT
Lines: 26

kortink@utrcu1.UUCP (Kortink John) wrote:
>> [...] compiled BASIC is only a tenth the speed of efficiently written
>> compiled C, and 1/12 that of raw ARM code.
>
> Utter nonsense. Good, optimized ARM code is at least twice as fast and
> short as any C code.

No; the ratio quoted (C is 17% slower) is typical of current compiler
technology on non-disgusting machines (the Intel i860 is disgusting;
the ARM is not).  If you can regularly achieve twice the speed of your
compiler's output, then I suggest that your compiler is not very good.

Some cases can still benefit from human sneakiness, but these are
usually small.  The ARM is so wonderfully simple, it's hard to hide a
possibility from a compiler.  The main source of improvement I'd expect
would be sneaky use of conditional instructions (test x; if <0, move -1
to x; if >0, move 1 to x => signum(x)) as is not a feature compiler
writers have had long experience with.

And in some cases (see Fred Brooks' The Mythical Man-Month), C (or other
compiled language) can be faster, not because it does X faster than an
assembler version, but becuase finishing it sooner let the C programmer
notice that X could be replaced with Y, which is less work.  Quicksort
in Apple II Basic is faster then bubblesort in Cray assembler.
-- 
	-Colin
