GNU bug report logs - #14966
24.3.50; Char-displayable-p is a very long running function

Previous Next

Package: emacs;

Reported by: "Sebastien Vauban" <sva-news <at> mygooglest.com>

Date: Sat, 27 Jul 2013 09:49:02 UTC

Severity: minor

Tags: moreinfo, wontfix

Found in version 24.3.50

Done: Stefan Kangas <stefan <at> marxist.se>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 14966 in the body.
You can then email your comments to 14966 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#14966; Package emacs. (Sat, 27 Jul 2013 09:49:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Sebastien Vauban" <sva-news <at> mygooglest.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 27 Jul 2013 09:49:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "Sebastien Vauban" <sva-news <at> mygooglest.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3.50; Char-displayable-p is a very long running function
Date: Sat, 27 Jul 2013 11:47:30 +0200
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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14966; Package emacs. (Sat, 27 Jul 2013 10:50:03 GMT) Full text and rfc822 format available.

Message #8 received at 14966 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Sebastien Vauban <sva-news <at> mygooglest.com>
Cc: 14966 <at> debbugs.gnu.org
Subject: Re: bug#14966: 24.3.50;
 Char-displayable-p is a very long running function
Date: Sat, 27 Jul 2013 13:49:08 +0300
> From: "Sebastien Vauban" <sva-news <at> 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?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14966; Package emacs. (Sat, 27 Jul 2013 12:00:03 GMT) Full text and rfc822 format available.

Message #11 received at 14966 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: "Sebastien Vauban" <public-sva-news-D0wtAvR13HarG/iDocfnWg <at> plane.gmane.org>
Cc: public-14966-ubl+/3LiMTaZdePnXv/OxA <at> plane.gmane.org
Subject: Re: bug#14966: 24.3.50;
 Char-displayable-p is a very long running function
Date: Sat, 27 Jul 2013 13:59:36 +0200

"Sebastien Vauban" <sva-news-D0wtAvR13HarG/iDocfnWg <at> 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 <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14966; Package emacs. (Sat, 27 Jul 2013 14:22:01 GMT) Full text and rfc822 format available.

Message #14 received at 14966 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: "Sebastien Vauban" <sva-news <at> mygooglest.com>
Cc: 14966 <at> debbugs.gnu.org
Subject: Re: bug#14966: 24.3.50;
 Char-displayable-p is a very long running function
Date: Sat, 27 Jul 2013 10:21:37 -0400
> 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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14966; Package emacs. (Mon, 29 Jul 2013 08:21:01 GMT) Full text and rfc822 format available.

Message #17 received at 14966 <at> debbugs.gnu.org (full text, mbox):

From: "Sebastien Vauban" <sva-news <at> mygooglest.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 14966 <at> debbugs.gnu.org
Subject: Re: bug#14966: 24.3.50;
 Char-displayable-p is a very long running function
Date: Mon, 29 Jul 2013 10:19:47 +0200
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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14966; Package emacs. (Mon, 29 Jul 2013 08:27:02 GMT) Full text and rfc822 format available.

Message #20 received at 14966 <at> debbugs.gnu.org (full text, mbox):

From: "Sebastien Vauban" <sva-news <at> mygooglest.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 14966 <at> debbugs.gnu.org
Subject: Re: bug#14966: 24.3.50;
 Char-displayable-p is a very long running function
Date: Mon, 29 Jul 2013 10:18:26 +0200
Eli Zaretskii wrote:
>> From: "Sebastien Vauban" <sva-news <at> 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.

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14966; Package emacs. (Mon, 29 Jul 2013 16:26:01 GMT) Full text and rfc822 format available.

Message #23 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Sebastien Vauban <sva-news <at> mygooglest.com>
Cc: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#14966: 24.3.50;
 Char-displayable-p is a very long running function
Date: Mon, 29 Jul 2013 19:24:40 +0300
> From: "Sebastien Vauban" <sva-news <at> 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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14966; Package emacs. (Wed, 18 Nov 2020 15:25:01 GMT) Full text and rfc822 format available.

Message #26 received at 14966 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Sebastien Vauban <sva-news <at> mygooglest.com>, 14966 <at> debbugs.gnu.org
Subject: Re: bug#14966: 24.3.50;
 Char-displayable-p is a very long running function
Date: Wed, 18 Nov 2020 07:24:21 -0800
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: "Sebastien Vauban" <sva-news <at> 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.




Added tag(s) moreinfo. Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Wed, 18 Nov 2020 15:25:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14966; Package emacs. (Wed, 18 Nov 2020 17:15:02 GMT) Full text and rfc822 format available.

Message #31 received at 14966 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: sva-news <at> mygooglest.com, 14966 <at> debbugs.gnu.org
Subject: Re: bug#14966: 24.3.50;
 Char-displayable-p is a very long running function
Date: Wed, 18 Nov 2020 19:13:55 +0200
> From: Stefan Kangas <stefan <at> marxist.se>
> Date: Wed, 18 Nov 2020 07:24:21 -0800
> Cc: Sebastien Vauban <sva-news <at> mygooglest.com>, 14966 <at> 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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#14966; Package emacs. (Wed, 18 Nov 2020 18:31:01 GMT) Full text and rfc822 format available.

Message #34 received at 14966 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 14966 <at> debbugs.gnu.org
Subject: Re: bug#14966: 24.3.50;
 Char-displayable-p is a very long running function
Date: Wed, 18 Nov 2020 10:29:57 -0800
tags 14966 wontfix
close 14966
thanks

Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Stefan Kangas <stefan <at> marxist.se>
>> Date: Wed, 18 Nov 2020 07:24:21 -0800
>> Cc: Sebastien Vauban <sva-news <at> mygooglest.com>, 14966 <at> 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.




Added tag(s) wontfix. Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Wed, 18 Nov 2020 18:31:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 14966 <at> debbugs.gnu.org and "Sebastien Vauban" <sva-news <at> mygooglest.com> Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Wed, 18 Nov 2020 18:31:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 17 Dec 2020 12:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 125 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.