unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Ergus <spacibba@aol.com>
To: tomas@tuxteam.de
Cc: help-gnu-emacs@gnu.org
Subject: Re: About early-init right use.
Date: Tue, 2 Apr 2019 18:55:22 +0200	[thread overview]
Message-ID: <20190402165522.nsllny2i4bphy7xi@Ergus> (raw)
In-Reply-To: <20190402154222.GA9550@tuxteam.de>

I know the manual is pretty nice, but some good examples for the "things
to put before the GUIs get initialized" is not a bad idea.  

I mixed some things I found here and there and mixed everything to
optimize the startup time (as an experiment)

```
(defconst my/start-time (current-time))

(defvar file-name-handler-alist-old file-name-handler-alist)

(setq file-name-handler-alist nil
      message-log-max 16384
      gc-cons-threshold most-positive-fixnum   ;; Defer Garbage collection
      gc-cons-percentage 1.0)

(add-hook 'emacs-startup-hook
          `(lambda ()
             (setq file-name-handler-alist file-name-handler-alist-old
                   gc-cons-threshold 800000
                   gc-cons-percentage 0.1)
			 (garbage-collect)
			 (message "Load time %.06f"
					  (float-time (time-since my/start-time)))) t)

(tool-bar-mode   -1)
(menu-bar-mode   -1)
(scroll-bar-mode -1)
(tooltip-mode    -1)			;; Tool tip in the echo
(flymake-mode    -1)

;;__________________________________________________________
;; For using Melpa and Elpa
(setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/")
						 ("melpa" . "https://melpa.org/packages/")))

(setq package-quickstart t)

;;-------------------- Some tricks--------------------------
(provide 'early-init)
;;; early-init.el ends here

```

In fact this, mixed with the use-package :bind :commands and so on
reduced my loading time from ~2 to ~0.9 seconds.

But I think this is a little bit too much for the early init and some of
the options doesn't really produce any improvement, so they should go in
the init.el

But I wanted to have a "stronger" argument about what to put and what
not.



On Tue, Apr 02, 2019 at 05:42:22PM +0200, tomas@tuxteam.de wrote:
>On Tue, Apr 02, 2019 at 07:21:30AM -0700, Drew Adams wrote:
>> > from the 27.0.50 manual (Node "Customization > Init File >
>> > Early Init File"):
>> >
>> >     This file is loaded before the
>> >     package system and GUI is initialized, so in it you can customize
>> >     variables that affect frame appearance as well as the package
>>       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>> >     initialization process...
>> >
>> >     the early init file is read before the GUI is initialized,
>> >     so customizations related to GUI features will not work reliably
>>          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>> >     in ‘early-init.el’.
>>
>> Seems a bit contradictory wrt "variables that affect frame
>> appearance".  What variables are we talking about, if they
>> are not "related to GUI features"?
>
>Hm. I read it differently: putting things in early-init.el gives you
>the chance to do things /before/ GUI and frame-appearance things are
>initialized. Thus it gives you the power to fix things, but also
>to break things.
>
>Put it another way: you almost never want to put anything into
>early-init.el -- unless you have the hunch that you need to change
>something before GUIs get initialized (e.g. to let them "see" a
>different variable value).
>
>Or more TL;DR you better know why you are in there ;-D
>
>Cheers
>-- tomás





  reply	other threads:[~2019-04-02 16:55 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20190401235436.2cnhvuxzdj635hpn.ref@Ergus>
2019-04-01 23:54 ` About early-init right use Ergus
2019-04-02  6:39   ` tomas
2019-04-02 14:21     ` Drew Adams
2019-04-02 15:42       ` tomas
2019-04-02 16:55         ` Ergus [this message]
2019-04-02 17:26           ` tomas
2019-04-02 18:40           ` Stefan Monnier
2019-04-03 17:21             ` Lele Gaifax
2019-04-03 17:28               ` Stefan Monnier
2019-04-03 17:43                 ` Lele Gaifax
2019-04-04  6:18                   ` Lele Gaifax
2019-04-02 17:09       ` Stefan Monnier
2019-04-02 17:57         ` Drew Adams

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=20190402165522.nsllny2i4bphy7xi@Ergus \
    --to=spacibba@aol.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=tomas@tuxteam.de \
    /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.
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).