emacs-devel
[Top][All Lists]
Advanced

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

Re: master 192f935 1/3: Add 'define-keymap' and 'defvar-keymap'


From: Lars Ingebrigtsen
Subject: Re: master 192f935 1/3: Add 'define-keymap' and 'defvar-keymap'
Date: Tue, 05 Oct 2021 08:31:24 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

By the way, when looking at how this is byte-compiled, I was surprised
to find that there's a lot of byte code in what's basically just a call
to a function with two parameters (that are both lists), so I had a look
at what's happening.

If a defvar is a single list, it's byte-compiled as a single list.  So
the first form results in the second in the .elc file:

(defvar foo-foo
  (list :foo "bar" "f" #'forward-line  "b" #'previous-line))

(defvar foo-foo (list :foo "bar" "f" 'forward-line "b" 'previous-line))

But if we involve more things, like this:

(defvar foo-foo
  (list (list :foo "bar") "f" #'forward-line  "b" #'previous-line))

(defvar foo-foo (byte-code "\300\301D\302\303\304\305\257^E\207" [:foo "bar" 
"f" forward-line "b" previous-line] 5))

The latter is longer both in the .elc file and in-memory size (if
memory-report is to be believed), and presumably also takes longer to
execute?  We've got a whole lot of defvars in Emacs that are basically
lists, so I wonder whether this is something that should be tweaked in
the byte compiler?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




reply via email to

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