I'm not a C programmer and I am reading the GNU Emacs Lisp manual. Something grabs my attention in E.1 Building Emacs is Emacs use dumping to get a executable program other than temacs.

I am wondering why Emacs choose to do this. After searching through the documentation, my guess is Emacs use temacs to generate a platform specific version of Emacs and deal with some cross-platform problems.

If I am right, are there any other considerations (like performance) that Emacs chooses to do this?

  • This is a normal thing with lisps in general. SBCL (a common lisp implementation) builds binaries this way, and some people develop lisp programs by keeping a lisp running and adding and redefining functions on the fly.
    – user12563
    Jun 26 '18 at 18:53
  • 1
    That system got replaced with a new version that is relocatable just a couple of months ago: reddit.com/r/emacs/comments/aglmzu/…
    – Jeff Trull
    Apr 1 '19 at 21:25

I heard that the primary reason is performance. temacs is a stub of emacs that lacks most of the editing functionality, but does possess the ability to compile and load elisp. The editing functionality is coded in elisp which temacs compiles and loads to become a fully functional emacs. This process takes time, so rather than do it a startup, every time, it is done once at build time, and the results are dumped (ie, cached) for later.

This Linux Weekly News article from 2016 includes some details about the implementation, though it is primarily "shop talk" about changing the mechanics of dumping (aka unexec).

  • 1
    Even running on a relatively-recent machine with a SSD drive I timed the difference in start-up time as ~4 seconds un-dumped vs ~0.02 seconds dumped (and on older hardware one could expect this difference to be dramatically larger). emacs.stackexchange.com/a/16521
    – phils
    Jun 26 '18 at 21:13
  • 1
    The controversy isn't about dumping vs not dumping, it's just the particular method of dumping currently used is problematic (although the dependence on glibc malloc has by now been circumvented by using a different allocater before dumping).
    – npostavs
    Jun 26 '18 at 23:24
  • @npostavs, thank you! I edited the last paragraph accordingly. I searched the web for some information about using a different allocater, but I didn't find anything. Can you help?
    – daveloyall
    Jun 27 '18 at 14:39
  • 1
    Bug#22086 is the newer development which allows using a different allocator after dumping (dubbed "hybrid malloc"). See also lists.gnu.org/archive/html/emacs-devel/2016-10/msg00659.html, Bug#24358, and Bug#26952 for troubles with the old allocators.
    – npostavs
    Jun 27 '18 at 19:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.