unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* memory costs of storing lambdas?
@ 2003-04-30 11:06 Han-Wen Nienhuys
  2003-05-01  9:36 ` Mikael Djurfeldt
  0 siblings, 1 reply; 3+ messages in thread
From: Han-Wen Nienhuys @ 2003-04-30 11:06 UTC (permalink / raw)



(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   |   hanwen@cs.uu.nl   |   http://www.cs.uu.nl/~hanwen 


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-05-01 11:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-04-30 11:06 memory costs of storing lambdas? Han-Wen Nienhuys
2003-05-01  9:36 ` Mikael Djurfeldt
2003-05-01 11:38   ` memory costs of storing lambdas? (correction) Mikael Djurfeldt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).