Article View: comp.lang.functional
Article #1107Re: Why such poor recursive behaviour?
From: John Thingstad
Date: Thu, 31 Jul 2008 11:39
Date: Thu, 31 Jul 2008 11:39
59 lines
4402 bytes
4402 bytes
PīŋŊ Thu, 31 Jul 2008 10:01:37 +0200, skrev namekuseijin <namekuseijin@gmail.com>: > I wonder why most functional programming languages fail so badly at > what should be one of their primary main strengths: recursive > functions. > > In the well-known benchmarking game called "The computer game > shootout", most such languages fail miserably in the face of blazing > fast imperative code during the benchmarking of recursive functions > such as ackermann or fibonacci: > > http://shootout.alioth.debian.org/gp4/benchmark.php?test=recursive&lang=all > > The best is clean, only 1.6 slower than gcc C. > > The chart: > 1.6 Clean > 3.2 OCaml (just behind Fortran and Java!) > 3.3 F# (running in mono) > 3.4 SML on MLton (just after FreeBasic!) > 3.4 Haskell GHC (just after Java on gcj! almost a tie-in) > 3.6 CL on SBCL (almost as good as compiled lazy static Haskell) > 3.7 Scheme on Chicken (just after sbcl) > 4.0 SML/NJ (just after C# on mono) > 4.6 Scheme on Ikarus (just after Java -client!) > 8.1 Scheme PLT (just after Fortran, again) > > Well, that's about it. > > I know in the grand scheme of things, such timings are not that bad, > not orders of magnitude slower like some of the dynamic scripting > stinkers in the bottom, specially in the face of such classy and easy > syntax and semantics adding to programmer productivity. Still, kind > of a let down, like buying a Playstation 3 and waiting for a killer > app that never comes... > > Any thoughts? The fastest applicative code is in OCALM and Haskell. For better performance in CL you might try the series library. In a nutshell the above mentioned languages were based on experiences and reflections on performance in Lisp. It is based on experience with type inference and lazy evaluation. SBCL is better at type inference than other Lisp's so perhaps series under SBCL would give CL a more faveroable result. Most compilers today (Allegro Common Lisp, LispWorks) have focused more on OO performance under CLOS and fast memory management which matters more to many of the users of Lisp. Note that most users of Lisp used a mixed paradigm approach and that loop plays a important role in why the applicative performance has not been a priority. As in all compiled languages it depends more on the quality of the programmer than the compiler. Anyhow short example code doesn't accurately reflect the users perceived performance running real programs. Java's long loading time and memory use tend to shadow algorithm performance in real programs. In this sense CL scores a lot better. -------------- John Thingstad
Technical Details
Message-ID:
<op.ue5mndfwut4oq5@pandora.alfanett.no>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news2.google.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local02.nntp.dca.giganews.com!nntp.telenor.com!news.telenor.com.POSTED!not-for-mailReferences:
<525fb940-a88e-4276-bd80-86b0b178a08a@m3g2000hsc.googlegroups.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 107f24,904ab2e1d637ae0f X-Google-Thread: ff861,904ab2e1d637ae0f X-Google-Thread: 10707f,904ab2e1d637ae0f X-Google-Thread: 103d24,904ab2e1d637ae0f X-Google-Thread: f4fd2,904ab2e1d637ae0f X-Google-Attributes: gid107f24,gidff861,gid10707f,gid103d24,gidf4fd2,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news2.google.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local02.nntp.dca.giganews.com!nntp.telenor.com!news.telenor.com.POSTED!not-for-mail NNTP-Posting-Date: Thu, 31 Jul 2008 06:39:05 -0500 Date: Thu, 31 Jul 2008 13:39:03 +0200 Subject: Re: Why such poor recursive behaviour? From: "John Thingstad" <jpthing@online.no> Organization: private Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 MIME-Version: 1.0 Newsgroups: comp.lang.functional,fa.caml,fa.haskell,comp.lang.scheme,comp.lang.lisp References: <525fb940-a88e-4276-bd80-86b0b178a08a@m3g2000hsc.googlegroups.com> Content-Transfer-Encoding: 8bit Message-ID: <op.ue5mndfwut4oq5@pandora.alfanett.no> User-Agent: Opera Mail/9.51 (Win32) X-Antivirus: avast! (VPS 080730-0, 30.07.2008), Outbound message X-Antivirus-Status: Clean Lines: 59 X-Usenet-Provider: http://www.giganews.com X-Trace: sv3-hR1xCJ1ngX510TGVwextgvojXIsQWDdsCff9Bnhg5mDtQoV+J48uc3WbXHK/dCjUxeNkJA6Z1AkifKQ!eI1uhSI0q161ExLz5vbpKl+oJiSW/5dBaYWVv4iqWKFnC62m4ZgDhqysBw5l5v8mTQNkFuL9l/lW!vto= X-Complaints-To: news-abuse@telenor.net X-DMCA-Complaints-To: news-abuse@telenor.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.39