From: Hi-Angel <hiangel999@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Lexical binding doesn't seem to be faster?
Date: Thu, 7 Mar 2019 02:36:39 +0300 [thread overview]
Message-ID: <CAHGDjgAgPqi1WbPEJLoGrJ0-9qHeNKb7EJUOxkizFFe0dg5AyQ@mail.gmail.com> (raw)
I've stumbled upon a discussion about converting Emacs code to a
faster lexical-binding and that help needed. I noted that cc-mode.el
I'm regularly use doesn't have one, and figured I could help.
So I inserted to cc-mode.el in emacs-git revision I have:
;;; -*- lexical-binding: t -*-
The first bad sign happened to be sizes of cc-mode.elc:
;;; -*- lexical-binding: t -*- | 217581
;;; -*- lexical-binding: nil -*- | 212542
Lexical-binding bloats byte-code by 5KB. Odd. I tried comparing
assembly, but without experience in reading lisp assembly I haven't
come up with anything. So I thought "Okay, must be heavy inlining;
let's just compare the speed".
So, I took someone's function `with-timer` for benchmarking¹; and then
for both t and nil lexical-binding I did following steps:
1. `byte-compile` `cc-mode.el`
2. `load-file` `cc-mode.elc`
3. open a 5k lines C file²
4. Execute multiple times `(with-timer (c-font-lock-fontify-region 0
(point-max)))`
5. Kill the buffer.
These are results I got:
;;; -*- lexical-binding: t -*- | 1.174s, 1.144s, 1.177s, 1.125s, 1.177s
;;; -*- lexical-binding: nil -*- | 1.037s, 1.061s, 1.037s, 1.037s, 0.991s
1: https://emacs.stackexchange.com/a/541/2671#how-do-i-measure-performance-of-elisp-code
2: https://gitlab.freedesktop.org/libinput/libinput/blob/9a2d6f55b1276da11dd9b2c4c8e22a405576dfea/src/libinput.h
next reply other threads:[~2019-03-06 23:36 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-06 23:36 Hi-Angel [this message]
2019-03-08 5:39 ` Lexical binding doesn't seem to be faster? Stefan Monnier
2019-03-08 8:30 ` tomas
2019-03-08 13:53 ` Stefan Monnier
2019-03-09 8:21 ` tomas
2019-03-08 13:33 ` Hi-Angel
2019-03-09 15:06 ` Stefan Monnier
2019-03-10 15:16 ` Hi-Angel
2019-03-10 16:14 ` Hi-Angel
2019-03-10 18:07 ` Stefan Monnier
2019-03-10 18:47 ` Hi-Angel
2019-03-10 18:59 ` Stefan Monnier
2019-03-10 19:53 ` Hi-Angel
2019-03-10 20:48 ` Stefan Monnier
2019-03-10 21:22 ` Hi-Angel
2019-03-11 19:16 ` Hi-Angel
2019-03-11 19:26 ` 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=CAHGDjgAgPqi1WbPEJLoGrJ0-9qHeNKb7EJUOxkizFFe0dg5AyQ@mail.gmail.com \
--to=hiangel999@gmail.com \
--cc=help-gnu-emacs@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.