unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Eli Zaretskii <eliz@gnu.org>
Cc: eggert@cs.ucla.edu, rms@gnu.org, emacs-devel@gnu.org
Subject: Re: Prickliness of the "invalid byte code" stuff
Date: Tue, 18 Jun 2019 15:48:30 -0400	[thread overview]
Message-ID: <jwv36k67l4p.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <83fto6sphn.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 18 Jun 2019 21:44:04 +0300")

>> The files using this option are expected to be faster to load (because
>> we load a bit less into heap).
> There's also the effect on Emacs memory footprint, right?

Yes.

>> The downsides are:
>> - it doesn't work when the .elc files are compressed.
>> - it doesn't work when the .elc files are loaded via Tramp.
>> - If the .elc files is re-generated after the .elc file was loaded,
>>   calling functions from that file typically signal an error (such as
>>   "invalid byte code").
> The same problems happen with lazily loading doc strings, right?

Yes (at least for the third point (reload), not sure how the first two
points are affected by compression and access via Tramp).

> Or is that different in some way?

There are some qualitative differences:

- docstrings are only loaded in fairly specific circumstances (mostly
  C-h <foo>), whereas lazy loading of code can happen in the middle of
  arbitrary code execution, so an error there can be more troublesome.

- when lazy loading a docstring and we discover that the file has
  changed (which we admittedly don't always notice), the code currently
  is able to reload the .elc file to update the offset and try again.
  In contrast, for lazy loading of code, the code is currently unable to
  do that (this is the origin on this discussion: it could be fixed in
  the common cases, but last I looked at it, it'd require changes to the
  code which could be detrimental to the common case).

- when we don't notice that the file was modified (i.e. the offset is
  wrong, but it happens to point to a valid place), displaying the wrong
  docstring is just annoying, whereas loading the wrong bytecode can
  lead to much more severe problems.

>> A `grep byte-compile-dynamic: **/*.el` seems to indicate it's currently
>> used in 12 files bundled with Emacs.
> Any idea why those 12 use it?

I think in the 20th century, the performance difference could be
measured (at least in benchmarks, tho maybe also in actual use), but
I seriously doubt it makes a noticeable difference on machines of this
century (not sure if it's because of changes in hardware such as
available RAM or CPU speed, or because the growth of the rest of
Emacs dwarfs those effects, or what).


        Stefan




  reply	other threads:[~2019-06-18 19:48 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-15 12:36 Prickliness of the "invalid byte code" stuff Lars Ingebrigtsen
2019-06-15 14:30 ` Andreas Schwab
2019-06-16  2:40   ` Richard Stallman
2019-06-16 12:41     ` Lars Ingebrigtsen
2019-06-16 13:27       ` Stefan Monnier
2019-06-16 17:47     ` T.V Raman
2019-06-16 22:01       ` Stefan Monnier
2019-06-17  2:39         ` T.V Raman
2019-06-17 13:32           ` Stefan Monnier
2019-06-17 16:04             ` Richard Stallman
2019-06-17 18:10               ` Stefan Monnier
2019-06-17 22:52                 ` Paul Eggert
2019-06-17 22:53                   ` Stefan Monnier
2019-06-18  0:14                     ` T.V Raman
2019-06-18 12:14                       ` Stefan Monnier
2019-06-18 13:51                         ` T.V Raman
2019-06-18 14:15                           ` T.V Raman
2019-06-18 16:31                     ` Eli Zaretskii
2019-06-18 18:11                       ` Stefan Monnier
2019-06-18 18:23                         ` T.V Raman
2019-06-18 18:52                           ` Eli Zaretskii
2019-06-18 19:54                             ` T.V Raman
2019-06-19  2:36                               ` Eli Zaretskii
2019-06-19 13:54                                 ` T.V Raman
2019-06-19 15:36                                   ` Eli Zaretskii
2019-06-18 18:44                         ` Eli Zaretskii
2019-06-18 19:48                           ` Stefan Monnier [this message]
2019-06-18 19:52                             ` Stefan Monnier
2019-06-19 16:08                             ` Eli Zaretskii
2019-06-19 16:25                               ` Stefan Monnier
2019-06-19 17:04                                 ` Eli Zaretskii
2019-06-19 19:02                               ` Stefan Monnier
2019-06-19 21:35                                 ` T.V Raman
2019-06-21  7:52                                   ` Eli Zaretskii
2019-06-21 14:10                                     ` T.V Raman
2019-06-21 14:15                                       ` Eli Zaretskii
2019-06-21 14:34                                     ` Stefan Monnier
2019-06-21 15:04                                       ` Eli Zaretskii
2019-06-18  3:09                 ` Richard Stallman
2019-06-17 16:01           ` Richard Stallman

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwv36k67l4p.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=eggert@cs.ucla.edu \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=rms@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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).