From: Philipp Stephani <p.stephani2@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: Why is lexical binding so slow?
Date: Mon, 25 Dec 2017 21:20:23 +0000 [thread overview]
Message-ID: <CAArVCkRRC=8eCvnrjfOuvMZ=30AxJvsywrP3xBaOKD4hFxWkCA@mail.gmail.com> (raw)
In-Reply-To: <jwvk23q3d8k.fsf-monnier+gmane.emacs.devel@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 1001 bytes --]
Stefan Monnier <monnier@iro.umontreal.ca> schrieb am So., 2. Juli 2017 um
20:36 Uhr:
> > https://github.com/mooz/js2-mode/issues/426#issuecomment-312506855.
> > Why is that?
>
> Depends on specifics, so someone would have to investigate.
I that case the reason was just a dumb mistake on my part: I ran the
benchmark without byte-compiled files. With byte compilation lexical
binding becomes at least as fast as dynamic binding.
> > Shouldn't code compiled with lexical binding be at least as
> > fast as code compiled with dynamic binding?
>
> Not necessarily, no. E.g. when you use `mapcar` and the function
> argument has free lexical variables, the lexbind code will have to build
> a closure to pass to mapcar. The access to the lexical vars in the
> closure will usually be faster than the corresponding access to those
> vars via dynbinding, so if mapcar makes enough calls lexbind can still
> be faster, but if mapcar makes few calls, dynbind is faster.
>
>
Thanks for the explanation.
[-- Attachment #2: Type: text/html, Size: 1609 bytes --]
next prev parent reply other threads:[~2017-12-25 21:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-02 18:15 Why is lexical binding so slow? Philipp Stephani
2017-07-02 18:36 ` Stefan Monnier
2017-12-25 21:20 ` Philipp Stephani [this message]
2017-12-26 4:49 ` Eli Zaretskii
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='CAArVCkRRC=8eCvnrjfOuvMZ=30AxJvsywrP3xBaOKD4hFxWkCA@mail.gmail.com' \
--to=p.stephani2@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
/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.