help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Tracking down why emacsclient -c is so slow


From: Alex Bennee
Subject: Re: Tracking down why emacsclient -c is so slow
Date: Sat, 22 Aug 2009 15:03:21 +0100

2009/8/22 Peter Dyballa <Peter_Dyballa@web.de>:
>
> Am 22.08.2009 um 13:33 schrieb Alex Bennee:
>
>> It's definitely something other than graphics performance. The frame
>> actually appears very quickly it just takes a while before I can start
>> editing.
>
> So it is your init file/customisation.

Having dug deeper into what was going on it seems to be
color-theme-related, although for the life of me I'm not sure what is
happening.

If I apply the following patch to my .emacs everything is dine:

--- a/dotemacs
+++ b/dotemacs
@@ -514,9 +511,11 @@ on the command line"
 ; First we need the colour-theme package

 (if I-am-emacs-22+
+    (message "loading color-theme at %s" (current-time-string))
     (if (maybe-load-library "color-theme")
        (if (fboundp 'color-theme-initialize)
-           (color-theme-initialize))))
+           (color-theme-initialize)))
+    (message "loading color-theme done at %s" (current-time-string)))

But what is really revealing is the results of "elp" while profiling
the color-theme-gnome2 I was using:

Results with (message) hack
Function Name            Call Count  Elapsed Time  Average Time
=======================  ==========  ============  ============
modify-frame-parameters  10          0.023506      0.0023506
color-values             3           0.000159      5.299...e-05

Results without (message) hack
Function Name                                   Call Count  Elapsed
Time  Average Time
==============================================  ==========
============  ============
color-theme-gnome2                              1           6.949076
   6.949076
color-theme-install                             6
6.9489930000  1.1581655000
modify-frame-parameters                         28
6.8929370000  0.2461763214
color-theme-install-frame-params                6
6.8865859999  1.1477643333
color-theme-blue-gnus                           1           1.707156
   1.707156
color-theme-salmon-font-lock                    1           1.06505
   1.06505
color-theme-blue-erc                            1           1.045608
   1.045608
color-theme-salmon-diff                         1           1.041382
   1.041382
color-theme-blue-eshell                         1           1.040324
   1.040324
color-theme-install-faces                       6           0.062013
   0.0103355
color-theme-spec-compat                         218
0.0012549999  5.756...e-06
color-values                                    21          0.000656
   3.123...e-05
color-theme-filter                              18          0.000298
   1.655...e-05
color-theme-install-variables                   6           9.7e-05
   1.616...e-05
color-theme-plist-delete                        58
9.099...e-05  1.568...e-06
color-theme-alist-reduce                        12          3.9e-05
   3.25e-06
color-theme-canonic                             6
3.700...e-05  6.166...e-06
color-theme-alist                               12
1.100...e-05  9.166...e-07
color-theme-variables                           6           9e-06
   1.5e-06
color-theme-frame-params                        6           5.999...e-06  1e-06
color-theme-faces                               6           5.999...e-06  1e-06
color-theme-spec-filter                         1           2e-06         2e-06

Curiously the colours seem to be set up correctly each time, but this
really shouldn't be the case. Looking at the definition of
color-theme-gnome2 is looks to be recursive?

(defun color-theme-gnome2 ()
  "Wheat on darkslategrey scheme.
`color-theme-gnome' started it all.

This theme supports standard faces, font-lock, eshell, info, message,
gnus, custom, widget, woman, diary, cperl, bbdb, and erc.  This theme
includes faces for Emacs and XEmacs.

The theme does not support w3 faces because w3 faces can be controlled
by your default style sheet.

This is what you should put in your .Xdefaults file, if you want to
change the colors of the menus in Emacs 20 as well:

emacs*Background:               DarkSlateGray
emacs*Foreground:               Wheat"
  (interactive)
  (color-theme-blue-gnus)
  (let ((color-theme-is-cumulative t))
    (color-theme-blue-erc)
    (color-theme-blue-eshell)
    (color-theme-salmon-font-lock)
    (color-theme-salmon-diff)
    (color-theme-install
     '(color-theme-gnome2
       ((foreground-color . "wheat")
        (background-color . "darkslategrey")
        (mouse-color . "Grey")
        (cursor-color . "LightGray")
        (border-color . "black")
        (background-mode . dark))
       ((apropos-keybinding-face . underline)
        (apropos-label-face . italic)
        (apropos-match-face . secondary-selection)
        (apropos-property-face . bold-italic)
        (apropos-symbol-face . info-xref)
        (goto-address-mail-face . message-header-to-face)
        (goto-address-mail-mouse-face . secondary-selection)
        (goto-address-url-face . info-xref)
        (goto-address-url-mouse-face . highlight)
        (list-matching-lines-face . bold)
        (view-highlight-face . highlight))
       (default ((t (nil))))
       (bbdb-company ((t (:foreground "pale green"))))
       (bbdb-name ((t (:bold t :foreground "pale green"))))
       (bbdb-field-name ((t (:foreground "medium sea green"))))
       (bbdb-field-value ((t (:foreground "dark sea green"))))
       (bold ((t (:bold t))))
       (bold-italic ((t (:italic t :bold t :foreground "beige"))))
       (calendar-today-face ((t (:underline t))))
       (comint-highlight-prompt ((t (:foreground "medium aquamarine"))))
       (cperl-array-face ((t (:foreground "Yellow"))))
       (cperl-hash-face ((t (:foreground "White"))))
       (cperl-nonoverridable-face ((t (:foreground "SkyBlue"))))
       (custom-button-face ((t (:underline t :foreground "MediumSlateBlue"))))
       (custom-documentation-face ((t (:foreground "Grey"))))
       (custom-group-tag-face ((t (:foreground "MediumAquamarine"))))
       (custom-state-face ((t (:foreground "LightSalmon"))))
       (custom-variable-tag-face ((t (:foreground "Aquamarine"))))
       (diary-face ((t (:foreground "IndianRed"))))
       (dired-face-directory ((t (:bold t :foreground "sky blue"))))
       (dired-face-permissions ((t (:foreground "aquamarine"))))
       (dired-face-flagged ((t (:foreground "tomato"))))
       (dired-face-marked ((t (:foreground "light salmon"))))
       (dired-face-executable ((t (:foreground "green yellow"))))
       (fringe ((t (:background "darkslategrey"))))
       (highlight ((t (:background "PaleGreen" :foreground "DarkGreen"))))
       (highline-face ((t (:background "SeaGreen"))))
       (holiday-face ((t (:background "DimGray"))))
       (hyper-apropos-hyperlink ((t (:bold t :foreground "DodgerBlue1"))))
       (hyper-apropos-documentation ((t (:foreground "LightSalmon"))))
       (info-header-xref ((t (:foreground "DodgerBlue1" :bold t))))
       (info-menu-5 ((t (:underline t))))
       (info-node ((t (:underline t :bold t :foreground "DodgerBlue1"))))
       (info-xref ((t (:bold t :foreground "DodgerBlue1"))))
       (isearch ((t (:background "sea green"))))
       (italic ((t (:italic t))))
       (menu ((t (:foreground "wheat" :background "darkslategrey"))))
       (modeline ((t (:background "dark olive green" :foreground "wheat"))))
       (modeline-buffer-id ((t (:background "dark olive green"
:foreground "beige"))))
       (modeline-mousable ((t (:background "dark olive green"
:foreground "yellow green"))))
       (modeline-mousable-minor-mode ((t (:background "dark olive
green" :foreground "wheat"))))
       (region ((t (:background "dark cyan" :foreground "cyan"))))
       (secondary-selection ((t (:background "Aquamarine" :foreground
"SlateBlue"))))
       (show-paren-match-face ((t (:bold t :background "Aquamarine"
:foreground "steel blue"))))
       (show-paren-mismatch-face ((t (:background "Red" :foreground "White"))))
       (underline ((t (:underline t))))
       (widget-field-face ((t (:foreground "LightBlue"))))
       (widget-inactive-face ((t (:foreground "DimGray"))))
       (widget-single-line-field-face ((t (:foreground "LightBlue"))))
       (w3m-anchor-face ((t (:bold t :foreground "DodgerBlue1"))))
       (w3m-arrived-anchor-face ((t (:bold t :foreground "DodgerBlue3"))))
       (w3m-header-line-location-title-face ((t (:foreground "beige"
:background "dark olive green"))))
       (w3m-header-line-location-content-face ((t (:foreground "wheat"
:background "dark olive green"))))
       (woman-bold-face ((t (:bold t))))
       (woman-italic-face ((t (:foreground "beige"))))
       (woman-unknown-face ((t (:foreground "LightSalmon"))))
       (zmacs-region ((t (:background "dark cyan" :foreground "cyan"))))))))

But I'm still puzzled as to why putting a (message) in before loading
color-theme causes this drastic change in behaviour? It can't be a
race condition surely? Emacs is single threaded is it not?


>
> --
> Greetings


-- 
Alex, homepage: http://www.bennee.com/~alex/
http://www.half-llama.co.uk




reply via email to

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