all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: 15294@debbugs.gnu.org
Subject: bug#15294: 24.3.50; js2-mode parser is several times slower in lexical-binding mode
Date: Sun, 15 Sep 2013 01:04:22 -0400	[thread overview]
Message-ID: <jwvtxhmk7ty.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <5234FB3D.40209@yandex.ru> (Dmitry Gutov's message of "Sun, 15 Sep 2013 03:11:41 +0300")

> Can the fact that `dotimes', `dolist' and `loop' are advised with
> cl--wrap-in-nil-block', which expands into `catch' form, make much
> of a difference?

No, these only expand to `catch' if there's a `return' inside.

> `js2-get-token' has 13 local variables (*).  Which is, while not a little,
> far from 100.  Most of the other functions have fewer than that.

I don't know how many it takes to be significantly slower than `symbol-value'.

> Are you counting the global variables, too?

No.  But arguments, yes, and every (defvar <var>) between point and BOB
as well.

> The dynamic-binding interpreter has to work with them, too.  How is it
> that much faster?

Dynamic binding lookup is done by `symbol-value' which is just a field
access (plus checking that the var is not special (e.g. buffer-local or
a predefined C variable).

>>> But 2.6 vs 2.1, it still a noticeable regression. Do you suppose the usage
>>> of `setq' is the main contributor?
>> The problem goes as follows: ...
> Thank you for the detailed explanation.
> There are a few `catch' forms left there, for tags `continue' and `break',
> used for control flow. So, most of the 0.5s difference left is likely due to
> them, right?

The problem is not just the use of catch, but the combination of "catch"
with all those vars let-bound outside of catch, used inside, and mutated:
- make a variable immutable (i.e. remove the setqs on it) and that
  variable becomes more efficient again.
- move the let binding inside the catch, and the var becomes efficient again.
- don't use the variable inside the catch, and it becomes efficient again.


        Stefan





  reply	other threads:[~2013-09-15  5:04 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-06 20:59 bug#15294: 24.3.50; js2-mode parser is several times slower in lexical-binding mode Dmitry Gutov
2013-09-06 23:44 ` Xue Fuqiao
2013-09-07  3:15   ` Stefan Monnier
2013-09-08 22:32 ` Stefan Monnier
2013-09-10  2:04 ` Stefan Monnier
2013-09-13  3:40   ` Stefan Monnier
2013-09-13  3:59     ` Drew Adams
2013-09-13  4:37       ` Stefan Monnier
2013-09-13  5:45         ` Drew Adams
2013-09-13 13:01           ` Stefan Monnier
2013-09-14  0:09         ` Lexical let and setq Michael Welsh Duggan
2013-09-14  3:46           ` Stefan Monnier
2013-09-14 11:13             ` Lars Magne Ingebrigtsen
2013-09-14 14:04               ` Pascal J. Bourguignon
2013-09-15  5:11               ` Stefan Monnier
2013-09-14 21:47           ` Richard Stallman
2013-09-15  5:09             ` Stefan Monnier
2013-09-15 16:54               ` Richard Stallman
2013-09-15 17:06                 ` Stefan Monnier
2013-09-16 10:47                   ` Richard Stallman
2013-09-14  4:20     ` bug#15294: 24.3.50; js2-mode parser is several times slower in lexical-binding mode Dmitry Gutov
2013-09-14 14:27       ` Stefan Monnier
2013-09-15  0:11         ` Dmitry Gutov
2013-09-15  5:04           ` Stefan Monnier [this message]
2013-09-15 16:54           ` Richard Stallman
2013-09-15  0:24   ` Dmitry Gutov
2013-09-15  5:06     ` Stefan Monnier
2013-09-18 23:48   ` Stefan Monnier
2013-09-22  4:56     ` Dmitry Gutov
2013-10-03  5:00       ` Stefan Monnier
2013-10-04  2:38         ` Dmitry Gutov
2013-10-04 13:52           ` Stefan Monnier
2013-10-05  3:27             ` Dmitry Gutov
2014-12-14 12:31             ` Dmitry Gutov
2014-12-14 14:08               ` Stefan Monnier

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=jwvtxhmk7ty.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=15294@debbugs.gnu.org \
    --cc=dgutov@yandex.ru \
    /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.