Article View: comp.lang.functional
Article #638Re: Performance of Yale Haskell using various Lisps
From: Eliot Miranda;W211
Date: Sun, 04 Oct 1992 16:54
Date: Sun, 04 Oct 1992 16:54
47 lines
2261 bytes
2261 bytes
In <PETERSON-JOHN.92Oct2133900@sparrow.CS.Yale.Edu> peterson-john@CS.Yale.Edu (John C. Peterson) writes: >The first benchmark is nfib, which indicates the basic speed of >function calling and Int arithmetic. >module Main where >nfib :: Int -> Int >nfib 0 = 1 >nfib 1 = 1 >nfib n = nfib (n-1) + nfib (n-2) The above is an incorrect definition of nfib, it should be equivalent to nfib :: Int -> Int nfib 0 = 1 nfib 1 = 1 nfib n = nfib (n-1) + nfib (n-2) + 1 The idea is that the value returned by nfib is the same as the number of function calls required to compute it. So each invocation of nfib adds one, hence the extra '+ 1' in the last line of the correct definition. e.g. nfib(3) -> nfib(3-1) + nfib(3-1) + 1 -> 1 + 1 + 1 -> 3 Three invocations of nfib return 3. A rough estimate of function calls per second can be derived by dividing the value returned from some suitable invocation of nfib by the time required to compute that value. Its recommended that you find the invocation of nfib that takes nearest to thirty seconds to run and use that. Eliot Miranda, Lecturer email: eliot@dcs.qmw.ac.uk Department of Computer Science ARPA: eliot%dcs.qmw.ac.uk@nsf.ac.uk Queen Mary Westfield College UUCP: eliot@qmw-dcs.uucp Mile End Road, LONDON E1 4NS Tel: 071 975 5229 (+44 71 975 5229) Fax: 081 980 6533 (+44 81 980 6533) -- Eliot Miranda, Lecturer email: eliot@dcs.qmw.ac.uk Department of Computer Science ARPA: eliot%dcs.qmw.ac.uk@nsf.ac.uk Queen Mary Westfield College UUCP: eliot@qmw-dcs.uucp Mile End Road, LONDON E1 4NS Tel: 071 975 5229 (+44 71 975 5229) Fax: 081 980 6533 (+44 81 980 6533)
Technical Details
Message-ID:
<1992Oct4.165407.18151@dcs.qmw.ac.uk>Path:
arc1-ca.pugleaf.net!sparky!uunet!convex!darwin.sura.net!spool.mu.edu!agate!doc.ic.ac.uk!uknet!qmw-dcs!eliotReferences:
<PETERSON-JOHN.92Oct2133900@sparrow.CS.Yale.Edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!convex!darwin.sura.net!spool.mu.edu!agate!doc.ic.ac.uk!uknet!qmw-dcs!eliot From: eliot@dcs.qmw.ac.uk (Eliot Miranda;W211) Newsgroups: comp.lang.functional,comp.lang.lisp Subject: Re: Performance of Yale Haskell using various Lisps Message-ID: <1992Oct4.165407.18151@dcs.qmw.ac.uk> Date: 4 Oct 92 16:54:07 GMT References: <PETERSON-JOHN.92Oct2133900@sparrow.CS.Yale.Edu> Sender: usenet@dcs.qmw.ac.uk (Usenet News System) Distribution: comp Organization: Computer Science Dept, QMW, University of London Lines: 47 Nntp-Posting-Host: sterling.dcs.qmw.ac.uk