all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 11657@debbugs.gnu.org
Subject: bug#11657: 24.1.50; Byte compiler is a lot slower now, when run interpreted
Date: Sun, 10 Jun 2012 10:48:39 -0400	[thread overview]
Message-ID: <jwv62azw7l7.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <83y5nvswfs.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 10 Jun 2012 06:00:23 +0300")

>> One potential source of slowness is the use of `pcase' in macroexp.el:
>> when byte-compiled, this is not a problem since it's all macroexpanded
>> away into reasonably efficient code.  But when interpreted, the `pcase'
>> macro might get re-expanded over and over, and it's a macro that's
>> costly to expand (because it has to work fairly hard in order to get
>> this reasonably efficient code).  pcase.el uses a hash-table to memoize
>> the recent expansions, but if for some reason this memoization fails and
>> the pcase macro gets re-expanded all the time, then an 8-fold slowdown
>> would not surprise me.
> Is there any way I can help you look into this?

I suspect that the slowdown is linked to the stack increase, so if you
could show me the (Lisp) backtrace when it hits the 1500 mark, for
example, or better yet if we could compare the backtrace when it hits
1000 in the old code and in the new code.

Another would be to add some instrumentation code to the `pcase' macro,
to output a message everytime the cache misses.  E.g. use the patch below.


        Stefan


=== modified file 'lisp/emacs-lisp/pcase.el'
--- lisp/emacs-lisp/pcase.el	2012-06-09 03:14:44 +0000
+++ lisp/emacs-lisp/pcase.el	2012-06-10 14:47:34 +0000
@@ -215,8 +215,8 @@
   (and (symbolp upat) (not (memq upat pcase--dontcare-upats))))
 
 (defun pcase--expand (exp cases)
-  ;; (message "pid=%S (pcase--expand %S ...hash=%S)"
-  ;;          (emacs-pid) exp (sxhash cases))
+  (message "pid=%S (pcase--expand %S ...hash=%S)"
+           (emacs-pid) exp (sxhash cases))
   (let* ((defs (if (symbolp exp) '()
                  (let ((sym (make-symbol "x")))
                    (prog1 `((,sym ,exp)) (setq exp sym)))))






  reply	other threads:[~2012-06-10 14:48 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-09 11:30 bug#11657: 24.1.50; Byte compiler is a lot slower now, when run interpreted Eli Zaretskii
2012-06-09 20:07 ` Juanma Barranquero
2012-06-09 23:36   ` Christoph Scholtes
2012-06-10  1:24 ` Stefan Monnier
2012-06-10  3:00   ` Eli Zaretskii
2012-06-10 14:48     ` Stefan Monnier [this message]
2012-06-11  1:10       ` Stefan Monnier
2012-06-11 16:53         ` Eli Zaretskii
2012-06-14 19:09           ` Stefan Monnier
2012-06-14 23:56             ` Juanma Barranquero
2012-06-15  1:41               ` Stefan Monnier
2012-06-15  9:27               ` Eli Zaretskii
2012-06-15 19:43                 ` Juanma Barranquero
2012-06-15 20:04                   ` Eli Zaretskii
2012-06-20 16:33             ` Stefan Monnier
2012-06-20 23:02               ` Juanma Barranquero
2012-06-22 18:33               ` Eli Zaretskii
2012-06-25  1:02                 ` Glenn Morris

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwv62azw7l7.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=11657@debbugs.gnu.org \
    --cc=eliz@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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.