From: Han-Wen Nienhuys <hanwen@cs.uu.nl>
Subject: memory costs of storing lambdas?
Date: Wed, 30 Apr 2003 13:06:39 +0200 [thread overview]
Message-ID: <16047.44607.580379.626517@localhost.localdomain> (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
next reply other threads:[~2003-04-30 11:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-04-30 11:06 Han-Wen Nienhuys [this message]
2003-05-01 9:36 ` memory costs of storing lambdas? Mikael Djurfeldt
2003-05-01 11:38 ` memory costs of storing lambdas? (correction) Mikael Djurfeldt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=16047.44607.580379.626517@localhost.localdomain \
--to=hanwen@cs.uu.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).