Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!pacbell.com!tandem!zorch!xanthian From: xanthian@zorch.SF-Bay.ORG (Kent Paul Dolan) Newsgroups: comp.sys.amiga.advocacy Subject: Re: Good programmers and assembly language (very long) Message-ID: <1991Apr15.230113.29776@zorch.SF-Bay.ORG> Date: 15 Apr 91 23:01:13 GMT References: <7227@harrier.ukc.ac.uk> <1991Apr12.123455.24220@zorch.SF-Bay.ORG> <1991Apr12.182833.17825@mintaka.lcs.mit.edu> Organization: SF-Bay Public-Access Unix Lines: 52 rjc@geech.gnu.ai.mit.edu (Ray Cromwell) writes: > I agree with your post Kent, except for one important point. If > Miranda was ported to the Amiga, the library functions would be > written in very quick assembler. For instance, most C libraries for > the Amiga have the QSort fnction written in optimized Asm. The only > overhead is the C function call. Still, _algorithms_ are still far > more important than minimal assembler optimizations. Check out the > April issue of BYTE. Dave Quick (Amigan) made a minor improvement to > the old bubblesort algorithm which makes it faster than a QSort! And so could I, and so could you, since the worst case for quicksort and bubble sort are both n*n (different worst cases), and bubblesort has a simpler and therefore faster algorithm. Take a look at what the Miranda quicksort algorithm posted does with already sorted data; it is not a pretty sight, which is why quickersort picks the median of three randomly sampled points from the interval as the next pivot. Quicksort is popular because its _average_ case is so much faster than bubblesort's average case, but the ratings are more usually based on _worst_ case. See "How to Lie with Statistics" for more information on this fascinating area of human activity. ;-) As far as canned libraries, sure, but that wasn't the point of the thread. The Miranda example showed the tremendous expressive power of a functional language; _any_ language can look good calling a canned routine, but not every language can look good in a "get it coded in five minutes and get on with your life" environment. This is a very common one in the business world. (I helped purchase several 4GLs in a part of my 30 years of programming I don't usually emphasize a lot on my resume). That is why the 4th generation languages are making such big inroads there. "Write it, run it, throw it away" is a lot bigger part of the business programmer's life than most CS or engineering side folks realize, and it is often the case that the extra run time of a one shot 4th generation language program is more than compensated by the saved CPU cycles getting the code to run in the first place. And in a universe where time is money, getting the results fast is often a lot more important than getting them from the cheapest running program. All of us old fossils that "write FORTRAN in any language" look at the new functional languages with awe. I've had the delight of programming in METAFONT a bit, a hybred functional/imperative language that is a nice fit to my equational view of the world; like several folks posting here, I wish more of the new languages were available on the Amiga for beer budget hackers. Kent, the man from xanth.