unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Daniel Kraft <d@domob.eu>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: guile-devel@gnu.org
Subject: Re: Emacs Lisp, macros
Date: Wed, 15 Jul 2009 10:36:03 +0200	[thread overview]
Message-ID: <4A5D94F3.9050507@domob.eu> (raw)
In-Reply-To: <874ote3o8v.fsf@gnu.org>

Ludovic Courtès wrote:
>> as well as found a (hopefully good) solution to automatically create
>> fluids not yet present on reference. 
> 
> Is each Elisp variable mapped to a fluid?  Eventually, you may need VM
> instructions for fluid-{ref,set!}, to speed things up.

Yes it is; and I agree that variable references surely have terrible 
performance at the moment, because of other things that have to go on 
for each reference:

* see if there's a fluid with that name; create if not (but creation is 
only done once of course, so the performance hit is from the check only)

* reference the fluid to get the current value

* check if the value is the special elisp void, in which case an error 
is reported

So taking this all together, I think there's a lot of potential for 
optimization here!  Unfortunatly I think that all this is necessary to 
ensure the semantics, but two ideas:

1) As you suggested, try doing some parts of this with new VM 
operations.  Like all of these in one op, or maybe just a "reference and 
error on void" as one op, and/or "lookup the variable in some module, 
and create it if not there" as another.  I think we need some planning 
to get the right choice, but it certainly is an important thing for 
performance.  But for now I'd suggest to keep on with the current 
implementation and later see what the real performance bottle-neck is 
when running real-world code.

2) I already mentioned some ideas like that before, but if we do careful 
analysis of the elisp code, we can probably get rid of some 
fluid-references; for instance:

(let ((a 5))
   (setq a 1)
   (while ... something which references a a lot)
   (foobar 1 2 3))

In order to preserve dynamic scoping for a in the call to foobar, we 
still have to save a in a fluid as well as do the setq on the fluid 
value.  But all references to a within the while-loop (if they are 
reads) are known to refer to the let-bound a, so we could optimize them 
and not take a fluid-ref every now and then.

I think, however, that this can get fairly complicated and need a lot of 
tweeking in order to get a sensible optimization.  So for now I think we 
should try getting the real bottle-necks into VM opterations and see 
what that can buy.

> There's 1.5 framework.  The first one is under `test-suite/tests', used
> to test the API.  The remaining 0.5 is under `testsuite': it's inherited
> from Guile-VM and is used to make sure interpreted and compiled code
> yield the same result.
> 
> I think the best way would be to add, say,
> `test-suite/tests/elisp-compiler.test' (there's already `elisp.test'),
> and from there use a macro akin to Andy's `c&e' in `bytevectors.test'.

Ok thanks for the hint!  So far I did mainly look into testsuite, but 
then I'll take a look at the framework in test-suite and see if I can do 
something useful there :)

cheers,
Daniel




  reply	other threads:[~2009-07-15  8:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-14 19:48 Emacs Lisp, macros Daniel Kraft
2009-07-14 22:15 ` Ludovic Courtès
2009-07-15  8:36   ` Daniel Kraft [this message]
2009-07-23 22:14     ` Andy Wingo
2009-07-24  7:00       ` Daniel Kraft
2009-07-23 22:09 ` Andy Wingo

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=4A5D94F3.9050507@domob.eu \
    --to=d@domob.eu \
    --cc=guile-devel@gnu.org \
    --cc=ludo@gnu.org \
    /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).