[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] spectralnorm algorithm from comp. language shootout
From: |
felix winkelmann |
Subject: |
Re: [Chicken-users] spectralnorm algorithm from comp. language shootout |
Date: |
Mon, 6 Jun 2005 08:11:51 +0200 |
On 05 Jun 2005 17:20:40 +0200, Matthias Heiler <address@hidden> wrote:
> Hi,
>
> I played with the spectral norm algorithm from the computer language
> shootout http://tinylink.com/?fFObJZJlyQ
>
Here a few points:
- loop is (relatively) slow - it expands into at least one call/cc for example
(this isn't as bad as it sounds, continuations are fast with chicken, but if
you want to squeeze out perfornance, a simple 'do' loop is faster).
- I would add `(declare (block) (disable-interrupts))'.
- The real whopper: f64vector. Extracting doubles from a f64vector is
really costly: we have to cons flonums all the time. Putting the flonums
into a vector instead reduces the need to create flonums (there are already
consed and pointers to them are stored in the vector). This doesn't
work with the FFI-wrapped code, of course, which wants f64vectors.
Attached an altenative version, here the Scheme code needs about
7 seconds (compared to 13 seconds for the original version).
cheers,
felix
sn3.scm
Description: Text Data