unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Ken Raeburn <raeburn@raeburn.org>
To: Neil Jerram <neil@ossau.uklinux.net>
Cc: Andy Wingo <wingo@pobox.com>, Daniel Kraft <d@domob.eu>,
	guile-devel <guile-devel@gnu.org>
Subject: Re: Elisp performance
Date: Thu, 30 Jul 2009 19:54:07 -0400	[thread overview]
Message-ID: <BE03D4FB-6911-44B8-B8C5-AA43DBAD51A8@raeburn.org> (raw)
In-Reply-To: <87ocr1yle9.fsf@arudy.ossau.uklinux.net>

On Jul 30, 2009, at 16:18, Neil Jerram wrote:
> The main thing I believe that makes a fluid different from a normal
> variable is that a fluid can have a different value in each thread -
> which is not relevant to Elisp.

Not yet, at least.

And maybe that's enough.  There's other stuff in Emacs besides  
variable bindings that would require dynamic-wind support, like flet,  
save-excursion (preserves current buffer and position), with-output-to- 
string and with-output-to-temp-buffer (preserve 'standard-output'), as  
well as any number of explicit calls to unwind-protect from Elisp code  
to alter and restore other global state of the program (e.g., with set- 
default-file-modes or set-standard-case-table).  The current  
incarnation of these things assumes a single-threaded execution  
model.  So, since we can't make Emacs multithreaded by simply dropping  
Guile Elisp into it, if Emacs is all we're concerned about, maybe  
assuming single-threaded execution only is okay for now.

On the other hand, if we want users to be able to write code snippets  
in Elisp and have them callable from a concurrently-multithreaded  
Scheme program (no Emacs processes in sight), I think we'll want the  
multithreaded support for the basic Elisp language sooner rather than  
later, even if multithreaded Emacs needs much more work.

I also don't know how complicated a switch to stop using fluids would  
be.  If it's not too painful, the performance impact would be  
interesting to see -- does it get us closer to the performance of  
Emacs itself?

> See above.  I'm not sure why fluid access should be significantly
> slower than non-fluid access, so I would guess that the performance
> cost is coming from the dynamic-wind part.

For a program the size of Emacs, I'd be concerned about the numbers of  
fluids and dynamic states created, especially since the space cost  
(and run time cost for growing the vectors, every 20th new entry)  
grows with the product of the two.  The number of dynamic states may  
shrink, but the size of each dynamic state -- the number of allocated  
fluid slots -- doesn't shrink, it only grows.

While they don't really correlate to anything in Guile Elisp directly,  
the default max_specpdl_size (the specpdl stack is where things are  
tracked for unwinding -- previous bindings, unwind-protect calls,  
previous location data for save-excursion, etc) was raised to 1000 a  
few years ago, and the maximum lisp evaluation depth (limits calls to  
eval, funcall, apply) to 400 just a couple years ago.  I assume that's  
because the previous limits (650 and 300 respectively) were  
occasionally getting reached.  That suggests to me rather a lot of  
dynamic states, and probably a large number of fluids.

Ken




  reply	other threads:[~2009-07-30 23:54 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-29 12:50 Elisp performance Daniel Kraft
2009-07-30  3:23 ` Ken Raeburn
2009-07-31  5:15   ` Daniel Kraft
2009-08-04 15:51   ` Andy Wingo
2009-07-30 20:18 ` Neil Jerram
2009-07-30 23:54   ` Ken Raeburn [this message]
2009-07-31  6:09     ` Daniel Kraft
2009-08-04 10:26       ` Andy Wingo
2009-08-04 10:26     ` Andy Wingo
2009-07-31  6:02   ` Daniel Kraft
2009-07-31  9:59     ` Ken Raeburn
2009-07-31 15:14       ` Daniel Kraft
2009-08-04 11:14         ` Andy Wingo
2009-08-04 11:00     ` Andy Wingo
2009-08-08 22:15       ` Ludovic Courtès
2009-08-04 10:17   ` Andy Wingo
2009-08-04 10:54     ` Daniel Kraft
2009-08-04 15:58     ` Ken Raeburn
2009-08-04 15:47 ` Andy Wingo
2009-08-04 16:12   ` Ken Raeburn
2009-08-04 19:28     ` Andy Wingo
2009-08-04 16:17   ` Daniel Kraft
2009-08-04 19:25     ` 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=BE03D4FB-6911-44B8-B8C5-AA43DBAD51A8@raeburn.org \
    --to=raeburn@raeburn.org \
    --cc=d@domob.eu \
    --cc=guile-devel@gnu.org \
    --cc=neil@ossau.uklinux.net \
    --cc=wingo@pobox.com \
    /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).