Subject: Re: bug#30731: Slower startup using March (27.0.50) build in windows

From: Noam Postavsky <[email-masked]>
Date: Tue, 13 Mar 2018 21:38:41 -0400

Shuguang Sun <[email-masked]> writes:

> The trace-log from package-earlyload has less
> do-after-load-evaluation items which are supposed to be loaded during
> the package-initialize. However, it still takes longer time for
> custom-set-variables  during early package initialization.
> The two items, mail-prsvr.elc and mm-util.elc are in earlyload but
> not in lateload.

Hmm, somehow that was not so informative as I'd have hoped.  Maybe
measuring each setting individually would give more info, try this:

(require 'pcase)

(defmacro split-custom-set-variables (cset-form)
  (pcase cset-form
    (`(custom-set-variables . ,entries)
     `(progn
        ,@(mapcar
           (pcase-lambda (`(quote (,sym . ,args)))
             `(let ((t0 (current-time))
                    (tf nil))
                (custom-set-variables (quote (,sym . ,args)))
                (setq tf (current-time))
                (message "setting `%s': %.3fs" ',sym
                         (float-time (time-subtract tf t0)))))
           entries)))))

(split-custom-set-variables
 (custom-set-variables
  ...))