Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 UW 5/3/83; site uw-beaver Path: utzoo!watmath!clyde!burl!ulysses!mhuxl!cbosgd!ihnp4!houxm!houxz!vax135!cornell!uw-beaver!info-mac From: info-mac@uw-beaver (info-mac) Newsgroups: fa.info-mac Subject: MacPascal Benchmark Message-ID: <1071@uw-beaver> Date: Tue, 3-Jul-84 22:42:55 EDT Article-I.D.: uw-beave.1071 Posted: Tue Jul 3 22:42:55 1984 Date-Received: Thu, 5-Jul-84 00:20:08 EDT Sender: daemon@uw-beave Organization: U of Washington Computer Science Lines: 45 From: Stuart Reges A simple Pascal benchmark is given by the recursive fibonnaci calculation: program Fibonnaci (input, output); var number: integer; function fib (arg: integer): integer; begin if arg <= 2 then fib := 1 else fib := fib (arg - 1) + fib (arg - 2); end; begin repeat write ('number (0 to stop) ---> '); readln (number); if number <> 0 then writeln ('answer = ', fib (number)); until number = 0; end. This benchmark involves addition and a lot of function calls. The complexity of this calculation is (phi)^n where phi = golden ratio = (SQRT(5) + 1)/2. A nice property of this benchmark is that every time you increase "n" by 5 you increase the complexity by a factor of about 11. Here are some figures I got from three different systems that will be used for instruction at Stanford next Fall: "n" Waterloo MacPascal MacPascal DEC-20 Pascal Interpretter (integer) (longint) Compiled ----------------------------------------------------------------------- 15 50 seconds 6.7 seconds 5.9 seconds 20 540 seconds 70.5 seconds 63.5 seconds 0.2 seconds 25 702.0 seconds 1.7 seconds 30 19.7 seconds The Waterloo Pascal Interpretter runs on an IBM/PC. The MacPascal version using INTEGER could not calculate FIB (25) because it is greater then MAXINT. I don't know why the LONGINT version should be faster. That is counter-intuitive for me. The DEC-20 Pascal is Hedricks compiler from Rutgers. The time reported is actual CPU time. Other calculations were done with a wrist-watch, but should be accurate to within a quarter second. This is using the Beta version of MacPascal released last week. -------