Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!apple!agate!shelby!rutgers!cmcl2!lanl!jlg From: jlg@lanl.gov (Jim Giles) Newsgroups: comp.lang.c Subject: Re: a style question Message-ID: <65019@lanl.gov> Date: 5 Oct 90 21:20:30 GMT References: Organization: Los Alamos Natl Lab, Los Alamos, N.M. Lines: 48 From article , by meissner@osf.org (Michael Meissner): > In article <537@mtndew.Tustin.CA.US> friedl@mtndew.Tustin.CA.US (Steve > Friedl) writes: > [...] | | This is seductive but true only superficially. | | | | Q: Given two equally-talented teams of programmers, one using C and | | one using assembler, which team will produce the system with best | | execution time for a non-trivial program? | | | | A: The team writing in C. While the assembler folks are busy optimizing | | that inner loop, the C people are testing three different algorithms | | to see which one is *really* faster. | | Or even: | | A: The team writing in C has already produced two or three revisions, | changing the code so that it gives the customer what s/he wants, | instead of what s/he asked for. | | Also a possibility: | | A: The team writing in C, since the team writing in C has switched to | a new hardware platform that is not upwards compatible with the | previous platform, but it twice as fast.... But the answer generally found by experience is that the assembly is faster. The C language is so full of pitfalls that it usually takes as long to get a working version of _any_ algorithm written in C as it does to write it in assembly. There is a popular word processor which was originally written in assembly. They decided to invest a lot of money to produce a C version (to which end, they hired a lot of C 'gurus' so as not to be handicapped by lack of experience with the language). They confidently predicted the C version would be ready before the next release of the assembly version and would be nearly as fast. The C version actually took longer to write than the next _two_ major assembly version upgrades. The C version is considerably slower as well (like doing a global search and having to wait 10 seconds instead of instant response - the kind of thing that wastes considerable time for anyone unfortunate enough to be forced to use it). It is true that the C version has been ported to other machines - but what is the good of that? All they have is a slow word processor on more than one platform - it doesn't compete well with the native products on any machine. Meanwhile, their assembly version still sells well. As far as I can tell, this is a typical experience. J. Giles