*To*: Gottfried Barrow <igbi at gmx.com>*Subject*: Re: [isabelle] 64-bit Java is 6x faster than 32-bit for a recursive fibonacci*From*: Makarius <makarius at sketis.net>*Date*: Fri, 16 May 2014 16:35:12 +0200 (CEST)*Cc*: cl-isabelle-users at lists.cam.ac.uk*In-reply-to*: <5374F12E.2030901@gmx.com>*References*: <5374E9FA.1010201@gmx.com> <5374F12E.2030901@gmx.com>*User-agent*: Alpine 2.00 (LNX 1167 2008-08-23)

On Thu, 15 May 2014, Gottfried Barrow wrote:

On 14-05-15 11:23, Gottfried Barrow wrote:fun fib (n:int) = (if (n < 2) then n else (fib(n - 1) + fib(n - 2)));Knowing nothing about concurrency, naively, this looks to me like itwould be a perfect candidate, since there are two calls to fib.

It bugs me that when calculating fib(42), the Java process only works25% of my CPU.

Here is a version for Isabelle/ML that uses approx. 0% of CPU: ML {* fun fib2 f0 f1 n = if n = 1 then f1 else fib2 f1 (f0 + f1) (n - 1); fun fib n = if n = 0 then 1 else fib2 0 1 n; *}

Makarius

**Follow-Ups**:**Re: [isabelle] 64-bit Java is 6x faster than 32-bit for a recursive fibonacci***From:*Gottfried Barrow

**References**:**[isabelle] 64-bit Java is 6x faster than 32-bit for a recursive fibonacci***From:*Gottfried Barrow

**Re: [isabelle] 64-bit Java is 6x faster than 32-bit for a recursive fibonacci***From:*Gottfried Barrow

- Previous by Date: [isabelle] ISABELLE WORKSHOP and TUTORIAL
- Next by Date: Re: [isabelle] 64-bit Java is 6x faster than 32-bit for a recursive fibonacci
- Previous by Thread: Re: [isabelle] 64-bit Java is 6x faster than 32-bit for a recursive fibonacci
- Next by Thread: Re: [isabelle] 64-bit Java is 6x faster than 32-bit for a recursive fibonacci
- Cl-isabelle-users May 2014 archives indexes sorted by: [ thread ] [ subject ] [ author ] [ date ]
- Cl-isabelle-users list archive Table of Contents
- More information about the Cl-isabelle-users mailing list