bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#11657: 24.1.50; Byte compiler is a lot slower now, when run interpre


From: Stefan Monnier
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
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux)

>> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]