Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/5/84; site umn-cs.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxn!ihnp4!stolaf!mmm!umn-cs!waddingt From: waddingt@umn-cs.UUCP (Jake Waddington ) Newsgroups: net.micro.mac Subject: Floating Point bench-marks Message-ID: <887@umn-cs.UUCP> Date: Tue, 18-Feb-86 21:14:23 EST Article-I.D.: umn-cs.887 Posted: Tue Feb 18 21:14:23 1986 Date-Received: Fri, 21-Feb-86 05:20:24 EST Reply-To: waddingt@umn-cs.UUCP (Paul Fink ) Distribution: net.micro.mac Organization: Computer Science Dept., U of Minn, Mpls, MN Lines: 137 Summary: I, with the help some freinds, perform some simple bench marks on three development systems. The purpose of these timings was to help determine the suitability of the Mac for scientific, number crunching, programs. Also, to help detremine the best development system for these programs. Three seperate programs where run for the test. The structure of the programs was determined with very little insight in to the workings of the compilers All three programs used the same basic structure but with different functions. The code for the first program in C follows: main() { double a,s; double pi; double N[100][2]; int i, j; long t,t0; FILE *fp;*fopen(); printf("Using Arrays\n"); fp= fopen("Bench_Marks","w"); t = tickcount(); /* time outer loop in 60ths of seconds */ pi= 3.1415926535897932324; s=0; for(i=1;i<=10;++i){ for(j=0;j<100;++j){ a= j+1; N[j][1]= pi/a; N[j][2]= sin(N[j][1])/cos(N[j][1]); } for(j=0;j<100;++j){ a= j+1; a= a*(N[j][2]*cos(N[j][1])/sin(N[j][1])+ N[j][1]-atan(N[j][2])); s= s+a; } } t = tickcount() - t; printf("\nTime %5.2f sec.\n",(float)t/60.0); printf("s= %e\n",s); fprintf(fp,"Time %5.2f sec.\n",(float)t/60.0); fprintf(fp,"s= %e\n",s); fflush(fp); fclose(fp); /* Delay for User */ t0= tickcount(); printf("Done ?\n"); scanf("%*c"); } The the 2nd & 3th program were the same but the 2nd divided by 10 then mulitplied by 10, while the 3rd squared a value then took the square root of it. The structure is: double a,s; t = tickcount(); /* time outer loop in 60ths of seconds */ for(i=1;i<=1000;++i){ a= i; for(j=1;j<=10;++j) a= sqrt(a); for(j=1;j<=10;++j) a= a*a; s= s+a; } s/= 5050.0; t = tickcount() - t; a= 1.0 -s/100.0; printf("\nTime %5.2f sec.\n",(float)t/60.0); printf("s= %20.14f %5.3f%%\n",s,a); } Three three development systems differ in that two are "C", Aztec & MegaMax, and one is Pascal, TML. MegaMax and TML both use the Apple, Sane, floating point routines while Aztec uses their own. The times for three programs are: (1) "for loops" using floating point arrays & trig functions Compiler Relative Sec TML 1 91 Aztec C 2.0 181 MegaMax C 1.3 115 (2) "for loops" with /10 & *10 Compiler Relative Sec TML 1 23 Aztec C 1.7 40 MegaMax C 1.8 42 (3) "for loops" with sqr & sqrt Compiler Relative Sec TML 1 31 Aztec C 8.1 250 MegaMax C 1.9 58 Three features are notable from this data. First, TML Pascal is the easy "winner". I have been told that it also is fast in QuickDraw calls. Second, except for simple function MeagMax beats Aztec "C". This is attributable to the fast machine code of the Sane package verses the complied "C" code of Aztec floating piont functions. The last feature is the very long time given by Aztec "C" in the thrid program. This can only be a result of problem with their square root routine. This will require further checking. From these test I conclude that the Apple Sane math package is desirable in a development package. It also implies that TML Pascal would make a very good system. A vax 780 took 3 to 20 secounds to run the 3rd program. The wide spead in times due to the load. So the Mac does perform well for number crunching programs when run time is not extermly long or when one is forced to use a moderatly loaded system. For long programs main frames are still best. Development time should also be taken into account when compairing the Mac to a main frame. I beleive I can write and debug a program on the Mac far quicker than on a multi-user system. All three systems let the user write standard programs with the language's standard I/O calls. The Sane package has only the usual Pascal math functions, exp, ln, sqrt, sin, cos, arctan. TML and MegaMax have only these functions. Bench marks are not the only way to judge a development systems. Easy of use, completeness, and how bug free the package is. In short I find TML Pascal to be very good in all these points while MegaMax has many floating point bugs! Aztec C is a very good, very complete system. I will post more on this later. For now I have to get back to my studies. Paul Fink University of Minnesota Cosmic Ray Lab ihnp4!umn-cs!waddingt