* bug#14966: 24.3.50; Char-displayable-p is a very long running function
@ 2013-07-27 9:47 Sebastien Vauban
2013-07-27 10:49 ` Eli Zaretskii
` (5 more replies)
0 siblings, 6 replies; 11+ messages in thread
From: Sebastien Vauban @ 2013-07-27 9:47 UTC (permalink / raw)
To: 14966-ubl+/3LiMTaZdePnXv/OxA
Hello,
When looking at the performance of my .emacs at startup time, I've noticed
that (char-displayable-p) takes around 400 ms (!) to execute itself...
--8<---------------cut here---------------start------------->8---
(setq org-ellipsis
(if (char-displayable-p ?\u25B7) ;; white right-pointing triangle
" \u25B7" ;; string
'org-ellipsis))) ;; face
--8<---------------cut here---------------end--------------->8---
This figure is obtained on my (recently bought, from January 2013) i7 laptop,
when running on mains. If running on battery, that figure would even be
multiplied by a factor ~3.5.
Best regards,
Seb
--
Sebastien Vauban
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#14966: 24.3.50; Char-displayable-p is a very long running function
2013-07-27 9:47 bug#14966: 24.3.50; Char-displayable-p is a very long running function Sebastien Vauban
@ 2013-07-27 10:49 ` Eli Zaretskii
2013-07-27 11:59 ` Andreas Schwab
` (4 subsequent siblings)
5 siblings, 0 replies; 11+ messages in thread
From: Eli Zaretskii @ 2013-07-27 10:49 UTC (permalink / raw)
To: Sebastien Vauban; +Cc: 14966
> From: "Sebastien Vauban" <sva-news@mygooglest.com>
> Date: Sat, 27 Jul 2013 11:47:30 +0200
>
> When looking at the performance of my .emacs at startup time, I've noticed
> that (char-displayable-p) takes around 400 ms (!) to execute itself...
It calls the font driver to actually encode the character. That could
look up several fonts. FWIW, I see 219 ms on my i7 Windows desktop.
Unless char-displayable-p is called in an inner loop (is it?), this
shouldn't really matter, should it?
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#14966: 24.3.50; Char-displayable-p is a very long running function
2013-07-27 9:47 bug#14966: 24.3.50; Char-displayable-p is a very long running function Sebastien Vauban
2013-07-27 10:49 ` Eli Zaretskii
@ 2013-07-27 11:59 ` Andreas Schwab
2013-07-27 14:21 ` Stefan Monnier
` (3 subsequent siblings)
5 siblings, 0 replies; 11+ messages in thread
From: Andreas Schwab @ 2013-07-27 11:59 UTC (permalink / raw)
To: Sebastien Vauban; +Cc: public-14966-ubl+/3LiMTaZdePnXv/OxA
"Sebastien Vauban" <sva-news-D0wtAvR13HarG/iDocfnWg@public.gmane.org>
writes:
> When looking at the performance of my .emacs at startup time, I've noticed
> that (char-displayable-p) takes around 400 ms (!) to execute itself...
But only the first time. Once the displaying font is known it runs
fast.
Andreas.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#14966: 24.3.50; Char-displayable-p is a very long running function
2013-07-27 9:47 bug#14966: 24.3.50; Char-displayable-p is a very long running function Sebastien Vauban
2013-07-27 10:49 ` Eli Zaretskii
2013-07-27 11:59 ` Andreas Schwab
@ 2013-07-27 14:21 ` Stefan Monnier
[not found] ` <mailman.1908.1374926410.12400.bug-gnu-emacs@gnu.org>
` (2 subsequent siblings)
5 siblings, 0 replies; 11+ messages in thread
From: Stefan Monnier @ 2013-07-27 14:21 UTC (permalink / raw)
To: Sebastien Vauban; +Cc: 14966
> when running on mains. If running on battery, that figure would even be
> multiplied by a factor ~3.5.
By "would be" you mean you haven't actually tried it?
I'd expect that the 400ms are not all spent waiting for the CPU, but
some non-negligible part of it is spent waiting for I/O, so it might
not take much more time with a CPU running 5 times slower.
Stefan
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: bug#14966: 24.3.50; Char-displayable-p is a very long running function
[not found] ` <mailman.1908.1374926410.12400.bug-gnu-emacs@gnu.org>
@ 2013-07-29 8:10 ` Sebastien Vauban
2013-07-29 16:24 ` Eli Zaretskii
0 siblings, 1 reply; 11+ messages in thread
From: Sebastien Vauban @ 2013-07-29 8:10 UTC (permalink / raw)
To: bug-gnu-emacs-mXXj517/zsQ
Hi Andreas,
Andreas Schwab wrote:
> "Sebastien Vauban" <sva-news-D0wtAvR13HarG/iDocfnWg-XMD5yJDbdMReXY1tMh2IBg@public.gmane.org>
> writes:
>
>> When looking at the performance of my .emacs at startup time, I've noticed
>> that (char-displayable-p) takes around 400 ms (!) to execute itself...
>
> But only the first time. Once the displaying font is known it runs
> fast.
That's not clear from the tests I make. But, anyway, as I'm striving for a
sub-second Emacs startup time, I'm only interested in the first time...
Best regards,
Seb
--
Sebastien Vauban
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#14966: 24.3.50; Char-displayable-p is a very long running function
[not found] ` <mailman.1910.1374927252.12400.bug-gnu-emacs-mXXj517/zsQ@public.gmane.org>
@ 2013-07-29 8:18 ` Sebastien Vauban
0 siblings, 0 replies; 11+ messages in thread
From: Sebastien Vauban @ 2013-07-29 8:18 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 14966-ubl+/3LiMTaZdePnXv/OxA
Eli Zaretskii wrote:
>> From: "Sebastien Vauban" <sva-news-D0wtAvR13HarG/iDocfnWg@public.gmane.org>
>> Date: Sat, 27 Jul 2013 11:47:30 +0200
>>
>> When looking at the performance of my .emacs at startup time, I've noticed
>> that (char-displayable-p) takes around 400 ms (!) to execute itself...
>
> It calls the font driver to actually encode the character. That could
> look up several fonts. FWIW, I see 219 ms on my i7 Windows desktop.
FWIW, I can't reproduce it in a minimal Emacs file (and I remember that the
tests were, in fact, done on my wife's laptop, a recent i5).
Minimal Emacs file:
--8<---------------cut here---------------start------------->8---
(defconst em/emacs-load-time-start (float-time))
;; set default font for all frames
;; (modify-all-frames-parameters '((font . "Consolas-10"))) ;; 0.58 s (max 2.13 s on battery)
;; (modify-all-frames-parameters '((font . "Courier New-9"))) ;; 0.58 s (max 2.13 s on battery)
;; (modify-all-frames-parameters '((font . "DejaVu Sans Mono-9"))) ;; 0.07 s (max 0.25 s on battery)
;; (modify-all-frames-parameters '((font . "Lucida Sans Typewriter-9"))) ;; 0.13 s (max 0.48 s on battery)
;; (modify-all-frames-parameters '((font . "Lucida Console-9"))) ;; 0.57 s (max 2.09 s on battery)
;; default (i.e., nothing) ;; 0.58 s (max 1.83 s on battery)
(defadvice message (before leuven-when-was-that activate)
"Add timestamps to `message' output."
(ad-set-arg 0 (concat (format-time-string "[%Y-%m-%d %T.")
(substring (format-time-string "%N") 0 3)
(format-time-string "] ")
(ad-get-arg 0))))
(dolist (i '(1 2 3 4 5 6 7 8 9 10))
(setq org-ellipsis
(if (char-displayable-p ?\u25B7) ;; white right-pointing triangle
" \u25B7" ;; string
'org-ellipsis))
(message "Call nr %s" i))
(message "Loading Minimal Emacs... Done (in %.2f s)"
(- (float-time) em/emacs-load-time-start))
--8<---------------cut here---------------end--------------->8---
Notice that the time spent depends a lot on the chosen font!!! It is quite
constant (at 0.01 s diff when on mains) for one specific font. For another
font, it can be more than 8 x the time (from 0.07 to 0.58 s).
FWIW, I don't understand the timing in the *Messages* buffer:
--8<---------------cut here---------------start------------->8---
For information about GNU Emacs and the GNU system, type C-h C-a.
[2013-07-29 10:08:14.866] Call nr 1
[2013-07-29 10:08:14.869] Call nr 2
[2013-07-29 10:08:14.870] Call nr 3
[2013-07-29 10:08:14.870] Call nr 4
[2013-07-29 10:08:14.871] Call nr 5
[2013-07-29 10:08:14.872] Call nr 6
[2013-07-29 10:08:14.872] Call nr 7
[2013-07-29 10:08:14.873] Call nr 8
[2013-07-29 10:08:14.873] Call nr 9
[2013-07-29 10:08:14.874] Call nr 10
[2013-07-29 10:08:14.874] Loading Minimal Emacs... Done (in 0.58 s)
--8<---------------cut here---------------end--------------->8---
14.874 (after last call) - 14.866 (after first call) is 0.008 s, not really
0.580 s!???
Something really escapes me here.
> Unless char-displayable-p is called in an inner loop (is it?), this
> shouldn't really matter, should it?
I'm not sure to understand this sentence. What do you mean by inner loop?
As I said to Andreas, I'm looking (hard) to get a startup time of Emacs under
the second. So, for that purpose, yes, it does matter. Though, in general, it
certainly does not hurt that much.
Best regards,
Seb
--
Sebastien Vauban
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#14966: 24.3.50; Char-displayable-p is a very long running function
[not found] ` <mailman.1923.1374934927.12400.bug-gnu-emacs-mXXj517/zsQ@public.gmane.org>
@ 2013-07-29 8:19 ` Sebastien Vauban
0 siblings, 0 replies; 11+ messages in thread
From: Sebastien Vauban @ 2013-07-29 8:19 UTC (permalink / raw)
To: Stefan Monnier; +Cc: 14966-ubl+/3LiMTaZdePnXv/OxA
Stefan Monnier wrote:
>> when running on mains. If running on battery, that figure would even be
>> multiplied by a factor ~3.5.
>
> By "would be" you mean you haven't actually tried it?
I did not try only that portion of code. The factor 3.5 is what I observe on
my full Emacs config file.
> I'd expect that the 400ms are not all spent waiting for the CPU, but
> some non-negligible part of it is spent waiting for I/O, so it might
> not take much more time with a CPU running 5 times slower.
Best regards,
Seb
--
Sebastien Vauban
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#14966: 24.3.50; Char-displayable-p is a very long running function
2013-07-29 8:10 ` Sebastien Vauban
@ 2013-07-29 16:24 ` Eli Zaretskii
2020-11-18 15:24 ` Stefan Kangas
0 siblings, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2013-07-29 16:24 UTC (permalink / raw)
To: Sebastien Vauban; +Cc: 14966
> From: "Sebastien Vauban" <sva-news@mygooglest.com>
> Date: Mon, 29 Jul 2013 10:10:36 +0200
>
> I'm striving for a sub-second Emacs startup time, I'm only
> interested in the first time...
The usual way of solving this is to start Emacs only once, and leave
it running at all times.
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#14966: 24.3.50; Char-displayable-p is a very long running function
2013-07-29 16:24 ` Eli Zaretskii
@ 2020-11-18 15:24 ` Stefan Kangas
2020-11-18 17:13 ` Eli Zaretskii
0 siblings, 1 reply; 11+ messages in thread
From: Stefan Kangas @ 2020-11-18 15:24 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Sebastien Vauban, 14966
Eli Zaretskii <eliz@gnu.org> writes:
>> From: "Sebastien Vauban" <sva-news@mygooglest.com>
>> Date: Mon, 29 Jul 2013 10:10:36 +0200
>>
>> I'm striving for a sub-second Emacs startup time, I'm only
>> interested in the first time...
>
> The usual way of solving this is to start Emacs only once, and leave
> it running at all times.
The reported problem is that `char-displayable-p' takes too long to run
the first time it is called after starting a fresh Emacs.
The recipe is:
0. emacs -Q
1. (benchmark-run 1 (char-displayable-p ?\u25B7))
(The above takes 200ms here.)
Is this something we will want to do something about or is this all
working as expected? The discussion in the bug report suggests that
this is indeed something that we can live with.
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#14966: 24.3.50; Char-displayable-p is a very long running function
2020-11-18 15:24 ` Stefan Kangas
@ 2020-11-18 17:13 ` Eli Zaretskii
2020-11-18 18:29 ` Stefan Kangas
0 siblings, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2020-11-18 17:13 UTC (permalink / raw)
To: Stefan Kangas; +Cc: sva-news, 14966
> From: Stefan Kangas <stefan@marxist.se>
> Date: Wed, 18 Nov 2020 07:24:21 -0800
> Cc: Sebastien Vauban <sva-news@mygooglest.com>, 14966@debbugs.gnu.org
>
> 0. emacs -Q
> 1. (benchmark-run 1 (char-displayable-p ?\u25B7))
>
> (The above takes 200ms here.)
>
> Is this something we will want to do something about or is this all
> working as expected? The discussion in the bug report suggests that
> this is indeed something that we can live with.
I think we can, indeed.
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#14966: 24.3.50; Char-displayable-p is a very long running function
2020-11-18 17:13 ` Eli Zaretskii
@ 2020-11-18 18:29 ` Stefan Kangas
0 siblings, 0 replies; 11+ messages in thread
From: Stefan Kangas @ 2020-11-18 18:29 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 14966
tags 14966 wontfix
close 14966
thanks
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Stefan Kangas <stefan@marxist.se>
>> Date: Wed, 18 Nov 2020 07:24:21 -0800
>> Cc: Sebastien Vauban <sva-news@mygooglest.com>, 14966@debbugs.gnu.org
>>
>> 0. emacs -Q
>> 1. (benchmark-run 1 (char-displayable-p ?\u25B7))
>>
>> (The above takes 200ms here.)
>>
>> Is this something we will want to do something about or is this all
>> working as expected? The discussion in the bug report suggests that
>> this is indeed something that we can live with.
>
> I think we can, indeed.
Thanks, closing.
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2020-11-18 18:29 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-27 9:47 bug#14966: 24.3.50; Char-displayable-p is a very long running function Sebastien Vauban
2013-07-27 10:49 ` Eli Zaretskii
2013-07-27 11:59 ` Andreas Schwab
2013-07-27 14:21 ` Stefan Monnier
[not found] ` <mailman.1908.1374926410.12400.bug-gnu-emacs@gnu.org>
2013-07-29 8:10 ` Sebastien Vauban
2013-07-29 16:24 ` Eli Zaretskii
2020-11-18 15:24 ` Stefan Kangas
2020-11-18 17:13 ` Eli Zaretskii
2020-11-18 18:29 ` Stefan Kangas
[not found] ` <mailman.1910.1374927252.12400.bug-gnu-emacs@gnu.org>
[not found] ` <mailman.1910.1374927252.12400.bug-gnu-emacs-mXXj517/zsQ@public.gmane.org>
2013-07-29 8:18 ` Sebastien Vauban
[not found] ` <mailman.1923.1374934927.12400.bug-gnu-emacs@gnu.org>
[not found] ` <mailman.1923.1374934927.12400.bug-gnu-emacs-mXXj517/zsQ@public.gmane.org>
2013-07-29 8:19 ` Sebastien Vauban
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).