kortink@utrcu1.UUCP (Kortink John) (02/17/91)
In article <1991Feb10.180855.17062@cns.umist.ac.uk> rogersh%t1a@uk.ac.man.cs (H.J. Rogers) writes : > In article <1991Feb9.075251.16439@rtf.bt.co.uk> brian@rtf.bt.co.uk (Brian > N Butterworth) writes: > [....] > BASIC is good for quick hacks and fast turnaround. Pascal is good for > beginners (it is a teaching language after all), but if you want the real > McCoy, C is the only solution. So you would you call all applications that are written using BASIC for the !RunImage part 'quick hacks' ? Strange. BASIC-V is lightning fast and is very suitable for handling the WIMP shell for the app. If you really want 'the real McCoy', and you're programming for the Archimedes only, you use ARM code. There have been numerous discussions on the relative merits of C and machinecode, but there's still the need for *real* speed sometimes. As soon as you're really 'into' ARM code, you don't need much time to solve even complex things. Once compatibility comes in, you use C. > The great advantage of C is it's *lack* of built in rubbish. All the i/o > etc. is in standard libraries, reducing the load image size of programs > which don't need (or want) a pile of utility functions linked in. This is a surprising statement. The all-famous 'Hello world' program, when compiled in C, grows out of all proportions because so many libary functions are not used at all. What's your definition of *rubbish* ? > [...] 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. John Kortink ----------------------------------------------------------------------------- Student of Informatics at the University of Twente, The Netherlands MAIL : kortink@utrcu1.uucp DISCLAIMER : you know .... "If language were liquid it would be rushing in Instead here we are Suzanne Vega (Solitude standing) in a silence more eloquent than any word could ever be" ------------------------------------------------------------------------------
ccplumb@rose.uwaterloo.ca (Colin Plumb) (02/18/91)
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
mathew@mantis.co.uk (mathew) (02/19/91)
kortink@utrcu1.UUCP (Kortink John) writes: > > The great advantage of C is it's *lack* of built in rubbish. All the i/o > > etc. is in standard libraries, reducing the load image size of programs > > which don't need (or want) a pile of utility functions linked in. > > This is a surprising statement. The all-famous 'Hello world' program, when > compiled in C, grows out of all proportions because so many libary functions > are not used at all. What's your definition of *rubbish* ? Hint: Get a good C compiler. If you write "Hello World" using <stdio.h> then yes, you get lots of junk. The point is that it's all OPTIONAL junk, which you asked for, and a smart compiler and linker can even cut out most of that. You can write "Hello world" programs in C using system libraries and pure native OS calls; I know because I've done it, and the result is a program not much bigger than the assembly language equivalent. > > [...] 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. Hint: Get a good C compiler. A good optimizing compiler can produce better assembly language code than the vast majority of assembler programmers. If you're David Braben, maybe you can write code which is twice as good as compiled C; but for most people, 1.2 times as good is about right. You should also bear in mind that the productivity of C programmers (in terms of working object code produced) is about ten times that of assembly language programmers. mathew.