unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: The current state of the comment-cache branch
Date: Tue, 27 Dec 2016 16:40:18 +0000	[thread overview]
Message-ID: <20161227164017.GC2324@acm.fritz.box> (raw)
In-Reply-To: <8360m9zf4h.fsf@gnu.org>

Hello, Eli.

On Sat, Dec 24, 2016 at 02:27:26PM +0200, Eli Zaretskii wrote:
> > Date: Sat, 24 Dec 2016 09:42:46 +0000
> > From: Alan Mackenzie <acm@muc.de>
> > Cc: emacs-devel@gnu.org

> > > Can you show similar timings with that variable set to nil?  And in
> > > particular in the use case reported by Paul back when bug#22884 was
> > > filed?

> > master:                        101.939s            95.049s        103.546s
> > (with open-paren-... nil)

> Hmm... doesn't match my timings here.

> With an optimized (-Og) build of Emacs 25.1.90, I get 42.844 with
> open-paren-in-column-0-is-defun-start t and 62.234 nil.  With the
> unoptimized build of the current master, I get 193.922 and 1117.469,
> respectively.  The 193 sec result is marginally reasonable for an
> unoptimized build, the 1117 sec result is IMO preposterous, and the
> 6-fold slowdown is IMO too much to be explained just by the variable.

If the buffer is large enough (were you using xdisp.c?) a large factor
slowdown from using o-p-i-c-0-i-d-s seems inevitable.

> Anyway, is your suggestion to adopt the code on that branch and set
> open-paren-in-column-0-is-defun-start to nil?  If we are not going to
> set it to nil, then the speed advantage is IMO too small to justify
> the changes.

No.  My suggestion is that open-paren-in-column-0-is-defun start ceases
to play any role in syntax.c.  Instead comments and strings will be
scanned only in the forward direction, the results of these scan
operations being cached in a text property.  `back_comment' in syntax.c
will be superseded by a new implementation which uses these text
properties, and various other parts of Emacs will be amended to ensure
these text properties stay consistent with the buffer and the current
syntax table.  All of this is implemented in the comment-cache branch,
and completely removes the cause of all of these paren bugs.

o-p-i-c-0-i-d-s would then have a role only in lisp.el in
`beginning-of-defun-raw'.

> Also, I wonder why do we need all these changes in syntax.c, when the
> problem is AFAIK only with C mode and its derivatives.  Are these
> changes beneficial in any way to modes with non-C syntax?

The changes are in syntax.c because this is where the fundamental cause
of the problem lies.  I don't believe it is possible to solve them in CC
Mode.  I don't know why the problem doesn't manifest itself in other
modes.  Perhaps other modes do less scanning of comments backwards (with
`scan-sexps' with a negative count).

> Thanks.

> P.S. What does "hwm" stand for in literal-cache-hwm?

As Paul suggested, "high water mark".  It is perhaps not a very good
name and could be changed.  The allusion is to the highest point on a
beach reached by the sea at high tide.  This is marked as a line on some
(English) maps under the abbreviation HWMOT, "high water mark, ordinary
tide".

-- 
Alan Mackenzie (Nuremberg, Germany).



  parent reply	other threads:[~2016-12-27 16:40 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-23 21:50 The current state of the comment-cache branch Alan Mackenzie
2016-12-24  1:32 ` Stefan Monnier
2016-12-24  9:07   ` Alan Mackenzie
2016-12-24  1:33 ` Stefan Monnier
2016-12-24  8:40   ` Alan Mackenzie
2016-12-24 20:56   ` Stephen Leake
2016-12-25 15:47     ` Stefan Monnier
2016-12-25 20:41     ` Richard Stallman
2016-12-24  8:02 ` Eli Zaretskii
2016-12-24  8:30   ` Alan Mackenzie
2016-12-24  8:55     ` Eli Zaretskii
2016-12-24  9:42       ` Alan Mackenzie
2016-12-24 11:11         ` Elias Mårtenson
2016-12-24 11:36           ` Alan Mackenzie
2016-12-24 12:00             ` Eli Zaretskii
2016-12-24 21:48               ` Andreas Röhler
     [not found]             ` <CADtN0W+7zHzuoWFrzs6MuonUM74D_dC+yh10rSk+r0nuxgeTBg@mail.gmail.com>
     [not found]               ` <CADtN0WJYXRg=oEBxn3UPjF6RFJG62nG4GpUFaphdkj9Egde_4Q@mail.gmail.com>
2016-12-24 12:21                 ` Elias Mårtenson
2016-12-27 17:55                   ` Alan Mackenzie
2016-12-28 15:36                     ` Eli Zaretskii
2016-12-28 16:42                       ` Alan Mackenzie
2016-12-28 16:45                       ` Nikolaus Rath
2016-12-28 17:09                         ` Eli Zaretskii
2016-12-28 23:58                           ` Nikolaus Rath
2016-12-29  3:43                             ` Eli Zaretskii
2016-12-29 16:56                               ` Nikolaus Rath
2016-12-29 17:46                                 ` Eli Zaretskii
2016-12-29 19:44                                   ` Alan Mackenzie
2016-12-30 10:29                                     ` Andreas Röhler
2017-01-03 17:39                                       ` Stefan Monnier
2017-01-20 18:58                                         ` Andreas Röhler
2017-01-20 21:48                                           ` Stefan Monnier
2017-01-21  9:06                                             ` Andreas Röhler
2017-01-22  4:28                                               ` Stefan Monnier
2016-12-28 17:15                         ` Stefan Monnier
2016-12-29  1:38                           ` Richard Stallman
2016-12-29  2:15                             ` Stefan Monnier
2016-12-24 12:27         ` Eli Zaretskii
2016-12-24 22:19           ` Paul Eggert
2016-12-25 16:07           ` Stefan Monnier
2016-12-25 16:30             ` Eli Zaretskii
2016-12-28  8:37             ` Alan Mackenzie
2016-12-28 17:02               ` Stefan Monnier
2016-12-28 17:10               ` Stefan Monnier
2016-12-27 16:40           ` Alan Mackenzie [this message]
2016-12-28 15:35             ` Eli Zaretskii
2016-12-28 16:35               ` Alan Mackenzie
2016-12-24 18:54 ` Richard Stallman
2016-12-27 16:11   ` Alan Mackenzie
2016-12-28  1:40     ` Dmitry Gutov
2016-12-28  7:54       ` Alan Mackenzie
2016-12-29  1:13         ` Dmitry Gutov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161227164017.GC2324@acm.fritz.box \
    --to=acm@muc.de \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).