emacs-devel
[Top][All Lists]
Advanced

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

Re: Is this "save practice" (setting default font scale)?


From: Arthur Miller
Subject: Re: Is this "save practice" (setting default font scale)?
Date: Sat, 21 Nov 2020 07:33:55 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Arthur Miller <arthur.miller@live.com>
>> Cc: emacs-devel@gnu.org
>> Date: Fri, 20 Nov 2020 16:37:51 +0100
>> 
>> > The pitfall is that the change in the default face will not be
>> > propagated to other faces that depend on 'default' (inherit from him
>> > and don't specify their own size explicitly).
>> Si, I understand. Does Daniel's answer (custom-set-face) have same problem?
>
> No.  But I don't expect it to provide any speedups, either.
I guess speedup comes from not re-doing work after the frame is
created. 

I did some measuremets:

(benchmark 1000000 (custom-set-faces '(default ((t (:height 140))))))
(benchmark 1000000 (set-face-attribute 'default nil :height 160)) 

In synthetic comparison as you say say there is no difference at all
Those two seem to execute roughtly about same time, ~0.017.

But when I switch between

(custom-set-faces '(default ((t (:height 140))))) and

(add-hook 'after-make-frame-functions
             (lambda (frame) 
               (set-face-attribute 'default nil :height 160)))
               
I can measure ~100ms slowdown regulary. It has to be the double work.

Another interesting thing I found is this executes a magnitude faster
then above two benchmarks:

(benchmark 1000000 (aset (cdr (assoc 'default face-new-frame-defaults)) 4 140))

Yet when I use it in init file, I see no difference in startup time
compared to custom-set-faces version.

I guess it is too little difference when it comes to other things going
on at startup. 



reply via email to

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