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

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

bug#14838: 24.3.50; repeating next-line or previous-line is broken


From: Stephen Berman
Subject: bug#14838: 24.3.50; repeating next-line or previous-line is broken
Date: Thu, 11 Jul 2013 20:51:42 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

On Thu, 11 Jul 2013 18:59:14 +0300 Eli Zaretskii <eliz@gnu.org> wrote:

>> From: Stephen Berman <stephen.berman@gmx.net>
>> Cc: 14838@debbugs.gnu.org
>> Date: Thu, 11 Jul 2013 12:04:07 +0200
>> 
>> Yes.  First, I found out that the problems I observed do not happen when
>> I repeat exactly the above recipe after having removed my ~/.Xresources
>> file and logged in again.  That file contains this:
>> 
>> Emacs.FontBackend: xft
>> Emacs.Font: DejaVu Sans Mono-9
>> 
>> ! ---------[ xft ] ---------
>> Xft*antialias:          true
>> Xft*autohint:           true
>> 
>> Without this, when I start Emacs with -Q, the font is still the one I
>> reported above, but now holding down C-n in NEWS works fine.  I don't
>> understand why, since I thought -Q means no X resources are read.
>
> It should.  Is inhibit-x-resources set when you invoke with -Q?

Yes, its value is t.

> Maybe the fact that X resources matter is a GTK thing?  Just
> guessing.  Jan, could you please comment on this?
>
>> When I start Emacs with my init file but without the .Xresources file, I
>> also don't observe the problem with C-n.  In my initializations, I have
>> the font DejaVu Sans Mono-9 set as default in a custom theme loaded from
>> my init file (I've been using the .Xresources file since long before
>> creating the them, and didn't try removing till now).  So without the
>> .Xresources file, I have no problem using C-n with this font, but with
>> the above .Xresources, the problem occurs with this font.  
>
> FWIW, I tried such a font as well (but without anti-aliasing), and
> didn't see any problem.
>
>> I started Emacs like this:
>> 
>> emacs -Q -l ~/bzr/emacs/quickfixes/lisp/simple.el
>> 
>> switched the default font to Adobe Courier as described above and then
>> followed your instructions; here is the report:
>> 
>> + call-interactively                                             6758  29%
>> + next-line                                                      6059  26%
>> + if                                                             5176  22%
>> + line-move                                                      3875  16%
>> + command-execute                                                 522   2%
>>   Automatic GC                                                    445   1%
>> + let                                                              86   0%
>> + redisplay_internal (C function)                                  35   0%
>> + prog1                                                            26   0%
>> + read-from-minibuffer                                             24   0%
>> + find-file-noselect                                               19   0%
>> + run-hooks                                                        18   0%
>> + condition-case                                                   16   0%
>> + cond                                                             12   0%
>> + view-file                                                         8   0%
>> + mapc                                                              4   0%
>> + list                                                              4   0%
>> + read-extended-command                                             4   0%
>> + vc-mode-line                                                      3   0%
>> + line-move-visual                                                  3   0%
>> + file-truename                                                     2   0%
>> + vc-find-file-hook                                                 2   0%
>> + vc-backend                                                        2   0%
>> + after-find-file                                                   2   0%
>> + completing-read                                                   2   0%
>> + let*                                                              1   0%
>> + view-emacs-news                                                   1   0%
>> + find-file-noselect-1                                              1   0%
>> + vc-call-backend                                                   1   0%
>>   internal-timer-start-idle                                         1   0%
>> + and                                                               1   0%
>
> What do you see if you completely expand the profile?  Do you see
> line-move-partial anywhere in the profile?  That's the only function
> where I made significant changes in the offending revisions, so if
> it's not high in the profile, I don't know what to think.

Here are the top 200 lines of another profile (not identical to the one
I posted previously, but similar), which account for 99% of the CPU
time.  Is this saying that 70% of CPU time is spent in line-move-partial
(and 82% in aref)?

- call-interactively                                             7225  30%
  - next-line                                                    7225  30%
    - if                                                         7225  30%
      - if                                                       7225  30%
        - condition-case                                         7225  30%
          - line-move                                            7225  30%
            - if                                                 7225  30%
              - if                                               7225  30%
                - if                                             5398  22%
                  - prog1                                        5398  22%
                    - let                                        5397  22%
                      - default-line-height                      5397  22%
                        - let                                    5397  22%
                          - default-font-height                  5397  22%
                            - cond                               5397  22%
                                aref                             5396  22%
                                display-multi-font                  1   0%
                    - line-move-visual                              1   0%
                      - let                                         1   0%
                        - if                                        1   0%
                          - let                                     1   0%
                            - posn-at-point                         1   0%
                                eval                                1   0%
                - and                                            1827   7%
                  - line-move-partial                            1827   7%
                    - if                                         1827   7%
                      - let*                                     1827   7%
                        - if                                     1801   7%
                          - progn                                1801   7%
                            - if                                 1799   7%
                                let                              1795   7%
                                if                                  3   0%
                                and                                 1   0%
                            - setq                                  2   0%
                                or                                  2   0%
                        - default-line-height                      21   0%
                          - let                                    21   0%
                            - if                                   21   0%
                                or                                 20   0%
                                display-graphic-p                   1   0%
                        - window-screen-lines                       5   0%
                          - let                                     5   0%
                            - default-line-height                   3   0%
                                let                                 3   0%
                            - /                                     2   0%
                                *                                   2   0%
- next-line                                                      6340  26%
  - if                                                           6340  26%
    - if                                                         6340  26%
      - condition-case                                           6340  26%
        - line-move                                              6340  26%
          - if                                                   6340  26%
            - if                                                 6340  26%
              - and                                              6247  25%
                - line-move-partial                              6247  25%
                  - if                                           6247  25%
                    - let*                                       6247  25%
                      - default-line-height                      5351  22%
                        - let                                    5351  22%
                          - default-font-height                  5350  22%
                            - cond                               5350  22%
                                aref                             5348  22%
                                display-multi-font                  2   0%
                          - if                                      1   0%
                            - display-graphic-p                     1   0%
                                framep-on-display                   1   0%
                      - if                                        891   3%
                        - progn                                   891   3%
                          - setq                                  888   3%
                            - or                                  888   3%
                                let                               888   3%
                          - if                                      3   0%
                            - let                                   3   0%
                                setq                                2   0%
                                pos-visible-in-win                  1   0%
                      - window-screen-lines                         5   0%
                        - let                                       5   0%
                          - default-line-height                     5   0%
                            - let                                   5   0%
                                if                                  4   0%
                                default-font-heigh                  1   0%
              - if                                                 93   0%
                - prog1                                            93   0%
                  - line-move-visual                               89   0%
                    - let                                          89   0%
                      - or                                         89   0%
                        - and                                      89   0%
                          - or                                     89   0%
                            - and                                  89   0%
                                >=                                 89   0%
                  - let                                             4   0%
                    - default-line-height                           4   0%
                      - let                                         4   0%
                        - default-font-height                       4   0%
                          - cond                                    4   0%
                            - aref                                  2   0%
                                font-info                           2   0%
                            - display-multi-font-p                  2   0%
                                framep-on-display                   2   0%
- if                                                             5387  22%
  - condition-case                                               5344  22%
    - line-move                                                  5344  22%
      - if                                                       5344  22%
        - if                                                     5344  22%
          - and                                                  5342  22%
            - line-move-partial                                  5342  22%
              - if                                               5342  22%
                - let*                                           5342  22%
                  - window-screen-lines                          5311  22%
                    - let                                        5311  22%
                      - default-line-height                      5311  22%
                        - let                                    5311  22%
                          - default-font-height                  5311  22%
                            - cond                               5311  22%
                                aref                             5310  22%
                                display-multi-font                  1   0%
                  - if                                             31   0%
                    - progn                                        31   0%
                      - if                                         23   0%
                        - let                                      23   0%
                          - pos-visible-in-window-                 23   0%
                            - eval                                 23   0%
                                if                                 21   0%
                                unless                              1   0%
                                mode-line-eol-desc                  1   0%
                      - setq                                        6   0%
                        - or                                        6   0%
                          - let                                     6   0%
                            - posn-at-point                         4   0%
                                eval                                3   0%
                                file-remote-p                       1   0%
                            - if                                    2   0%
                                cdr                                 2   0%
                      - cond                                        2   0%
                        - and                                       2   0%
                          - or                                      2   0%
                            - <                                     2   0%
                                setq                                2   0%
          - if                                                      2   0%
            - prog1                                                 2   0%
              - line-move-visual                                    2   0%
                - let                                               2   0%
                  - or                                              2   0%
                    - and                                           2   0%
                      - or                                          2   0%
                        - and                                       2   0%
                          - >=                                      2   0%
                            - vertical-motion                       2   0%
                                jit-lock-function                   2   0%
  - if                                                             43   0%
    - condition-case                                               43   0%
      - line-move                                                  43   0%
        - if                                                       43   0%
          - if                                                     43   0%
            - and                                                  43   0%
              - line-move-partial                                  43   0%
                - if                                               43   0%
                  - let*                                           43   0%
                    - window-screen-lines                          22   0%
                      - let                                        22   0%
                        - default-line-height                      22   0%
                          - let                                    22   0%
                            - if                                   21   0%
                                or                                 20   0%
                                display-graphic-p                   1   0%
                            - default-font-height                   1   0%
                                cond                                1   0%
                    - if                                           15   0%
                      - progn                                      15   0%
                        - if                                        9   0%
                          - let                                     9   0%
                            - pos-visible-in-windo                  9   0%
                                file-remote-p                       6   0%
                                eval                                3   0%
                        - setq                                      6   0%
                          - or                                      6   0%
                            - let                                   6   0%
                                posn-at-point                       5   0%
                                setq                                1   0%
                    - default-line-height                           6   0%
                      - let                                         6   0%
                        - default-font-height                       6   0%
                          - cond                                    6   0%
                            - aref                                  6   0%
                                font-info                           6   0%
- line-move                                                      4084  16%
  - if                                                           4084  16%
    - if                                                         4084  16%
      - and                                                      4084  16%
        - line-move-partial                                      4084  16%
          - if                                                   4084  16%
            - let*                                               4084  16%
              - if                                               4084  16%
                - progn                                          4084  16%
                  - if                                           4084  16%
                    - if                                         4083  16%
                      - and                                      4083  16%
                        - >=                                     4083  16%
                          - default-font-height                  4083  16%
                            - cond                               4083  16%
                                aref                             4083  16%


>> followed by exactly 175 repetitions of these two lines (I used `M-x
>> occur' to make sure they were all identical):
>> 
>> vs 0 dlh 14 this nil rowh 13 rbot 1 py 0 vpos 32 last 31.0
>> 2
>> 
>> and nothing else.
>
> The "py 0" part is very strange.  "py" is the vertical coordinate of
> point in screen line units.  Since this was with C-n, I expect py
> never to be less than half the screen height, which is 16.  How come
> it is zero, i.e. point is in the first line?  Can you step through
> line-move-partial in Edebug and see what is going on there?

If I instrument line-move-partial and type `C-n', I see py = 0 on the
first line and it increases by 1 on each subsequent line.  I have no
idea why *Messages* only showed a value of 0 for py; could it be that
the messages were overwritten when the CPU load hit 90%?  Is it possible
to make Edebug break execution only when that load level occurs?

>> > I also asked to try reducing the keyboard auto-repeat rate, and see if
>> > that makes any difference.
>> 
>> The default rate in my setup is 25 repeats/s.  I lowered it to 15 and
>> repeated the above experiment, and the problem again occurs, but starts
>> later, around line 300.  Then I lowered the repeat rate to 10, which is
>> annoyingly slow, and here too the problem occurs, starting around line
>> 500.
>
> This is consistent with the high CPU load you see.  But I'd be damned
> if I understand what is causing that CPU load, or why it happens with
> some fonts, but not others.
>
> Btw, do you have any local changes in your builds?

The builds I tested for my OP were from a branch that mirrors trunk,
plus or minus the changes to simple.el from before and after revision
113314; the only changes in the build used for profiling are those you
added to simple.el from 113360 to get the messages.

Steve Berman





reply via email to

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