In article <··················@qobi.ai>, ····@CS.Toronto.EDU wrote:
> Absolute performance is irrelevant to this discussion. The issue is the
> relative performance of the imperative vs. function versions. To date these
> benchmarks have been run by different people under several different Scheme
> implementations on several different machine architectures. All of them
> indicate that the imperative version is faster than the functional one, by a
> factor of between 1.5 and 3.
The Lisp 'FRPOLY' benchmark is a test of multivariate polynomial multiplication
code, perhaps from the original 'Mathlab' program. Since this code is written
in an 'imperative' style, I rewrote it in a 'functional' style and got within
6% or so of the performance of the original code, AND MY CODE INCLUDED
RECYCLING TIME, while the original code was benchmarked in such a way that
the GC wasn't ever called.
Now, my 'functional' program used 'linear types' -- a kind of object which
has a [0,1] reference count (it is singly-referenced) -- so that no reference
count updating was actually required, and dead cells could be recognized and
recycled immediately.
So, at least if you use 'linear types', you can program in a completely
functional style, and yet have the efficiency of an imperative style.
Details in:
ftp://ftp.netcom.com/pub/hb/hbaker/LFrpoly.html (also .ps.Z)
ftp://ftp.netcom.com/pub/hb/hbaker/Use1Var.html (also .ps.Z)
--
www/ftp directory:
ftp://ftp.netcom.com/pub/hb/hbaker/home.html