[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
memory costs of storing lambdas?
From: |
Han-Wen Nienhuys |
Subject: |
memory costs of storing lambdas? |
Date: |
Wed, 30 Apr 2003 13:06:39 +0200 |
(please CC replies, I'm not subscribed to guile-user)
Hi there,
I have a small question: I was wondering how much memory it costs to
store an anonymous function. I have to make choices between storing
various entities in lilypond either as a function, or as an
expression.
The following fictional example illustrates the distinction (#
introduces in-line Scheme in Lilypond syntax):
1. using anon functions:
(define (style-setter style)
(lambda (head) (set-note-head-style head style)))
...
\property Voice.NoteHead \set #'style-procedure
= #(style-setter "cross")
During the lilypond run, the anonymous function is called. Storage
cost: one anonymous function
2. using expressions
\property Voice.NoteHead \set #'style-expression
= #(list set-note-head-style "cross")
During the lilypond-run, a note-head pointer is prepended to the
argument list, and the list (set-note-head-style head style) is
evaluated.
Storage cost: a list of length 2.
I have the feeling that solution 1. is more expensive in terms of
memory than solution 2. My question: is this true, and how could I
have found out this answer myself? (i.e. where is the related
interpreter code?)
Thanks,
Han-Wen
--
Han-Wen Nienhuys | address@hidden | http://www.cs.uu.nl/~hanwen
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- memory costs of storing lambdas?,
Han-Wen Nienhuys <=