Xref: utzoo comp.sys.ibm.pc.programmer:166 comp.sys.ibm.pc:45372 Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!rpi!crdgw1!ge-dab!tarpit!bilver!alex From: alex@bilver.UUCP (Alex Matulich) Newsgroups: comp.sys.ibm.pc.programmer,comp.sys.ibm.pc Subject: How is a 68000 as fast as an 80386?? Keywords: I need more speed from my compiler Message-ID: <505@bilver.UUCP> Date: 28 Feb 90 00:30:19 GMT Distribution: na Organization: William J. Vermillion, Winter Park, FL Lines: 62 Can someone help me with a puzzling problem? In my current C programming project, I have written some functions that perform statistical things on 400 separate data sets (linear regressions, standard errors, etc). This number-crunching part takes about a minute to complete when I run it on my Amiga. My Amiga uses a 68000 running at 14 MHz (twice the normal cpu speed) and no math chip. The compiler is Lattice C 4.0 in 32-bit addressing mode (similar to the IBM "large" memory model). Naturally, I wanted more speed, so I ported the program to an AT&T 386WGS at work, which is a 25 MHz 80386 IBM compatible. I compiled it using Turbo C 2.0, large memory model. Then I watched in chagrined disbelief as that number-crunching section still took about a minute to execute -- actually a few seconds longer than my Amiga. All source code was the same! This is plainly ridiculous, I thought. I was always under the impression that there is NO WAY a 14 MHz Amiga can match the performance of a 25 MHz 80386 machine. I thought of a few possible reasons. I am sure they are way off base, because I have little familiarity with IBM-style architecture, but here they are: 1) Perhaps MS-DOS takes up a lot more overhead than AmigaDOS, but I doubt it. I always considered MS-DOS to be an operating system that gets in the way of the task at hand only minimally. I had no other programs resident. If anything, the Amiga Exec had more overhead, since there were two other "active" background tasks and 16 "waiting" background tasks for the operating system to worry about. 2) Possibly the IBM display is CPU-bound, as in the Macintosh, where program execution is only performed during vertical screen blanks. This isn't the case, is it? Isn't the video circuitry independent of the CPU? 3) Maybe the Turbo C compiler for IBM compatibles is not as efficient as the old Lattice compiler I use for the Amiga. I find it hard to believe. Perhaps each compiler's implementation of math functions like sqrt() are different enough to account for this incident. The math library I used on each machine was the default. On the Amiga, this is the slowest library. There are others (IEEE, FFP, etc) which are faster but they sacrifice precision. 4) Might the 68000's math instructions be more streamlined than those on the 80386? It takes 70 clock cycles to do a multiply and 158 to do a divide on a 68000, plus at most 16 cycles to calculate addresses. I don't know what the specs are for an 80386. 5) I know the 80386 has special modes of operation, incompatible with previous chips, that allow it to run at its full potential. Is this the reason my program isn't running at its rightful speed? Are these special modes accessible when using DOS? If so, how? I have absolutely no intention of starting a computer war here. This is new to me, and seems bizarre. I would like an explanation, and if possible some suggestions on speeding up the execution of my software on the 80386. IBM compatibles are the target machines for my software anyway (I just like doing the development on the Amiga). Please e-mail me any help (or flames?) and I'll summarize. -- /// Alex Matulich /// Unicorn Research Corp, 4621 N Landmark Dr, Orlando, FL 32817 \\\/// alex@bilver.UUCP ...uunet!tarpit!bilver!alex \XX/ From BitNet use: bilver!alex@uunet.uu.net