From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: Bug #25608 and the comment-cache branch Date: Sat, 4 Feb 2017 11:02:59 +0000 Message-ID: <20170204110259.GB2047@acm> References: <20170202202418.GA2505@acm> <9d0b3156-e8b2-c2d8-0d0c-a025861e5e0c@yandex.ru> <20170203164457.GB2250@acm> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1486206251 17435 195.159.176.226 (4 Feb 2017 11:04:11 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 4 Feb 2017 11:04:11 +0000 (UTC) User-Agent: Mutt/1.7.2 (2016-11-26) Cc: Eli Zaretskii , emacs-devel@gnu.org To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Feb 04 12:04:04 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cZy8Q-00049z-BM for ged-emacs-devel@m.gmane.org; Sat, 04 Feb 2017 12:04:02 +0100 Original-Received: from localhost ([::1]:38745 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZy8V-0005FY-Vc for ged-emacs-devel@m.gmane.org; Sat, 04 Feb 2017 06:04:07 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44393) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cZy7t-0005FR-MN for emacs-devel@gnu.org; Sat, 04 Feb 2017 06:03:30 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cZy7k-0002mq-FC for emacs-devel@gnu.org; Sat, 04 Feb 2017 06:03:25 -0500 Original-Received: from ocolin.muc.de ([193.149.48.4]:42869 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1cZy7k-0002mH-8O for emacs-devel@gnu.org; Sat, 04 Feb 2017 06:03:20 -0500 Original-Received: (qmail 45336 invoked by uid 3782); 4 Feb 2017 11:03:16 -0000 Original-Received: from acm.muc.de (p4FC46ADF.dip0.t-ipconnect.de [79.196.106.223]) by colin.muc.de (tmda-ofmipd) with ESMTP; Sat, 04 Feb 2017 12:03:16 +0100 Original-Received: (qmail 3732 invoked by uid 1000); 4 Feb 2017 11:02:59 -0000 Content-Disposition: inline In-Reply-To: X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x [fuzzy] X-Received-From: 193.149.48.4 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:211959 Archived-At: Hello, Dmitry. On Fri, Feb 03, 2017 at 23:53:31 +0200, Dmitry Gutov wrote: > On 03.02.2017 18:44, Alan Mackenzie wrote: > > Perhaps, for clarity's sake, you could post this alternative patch here, > > or if it's big, put it into a scratch branch. Then, at least we'll all > > know that we're talking about the same thing. > I've already posted the url. You did, indeed. Apologies. > The path is in the comments of the bug you're purportedly trying to > fix. So here is the message you unlimately ignored: > http://lists.gnu.org/archive/html/emacs-devel/2016-12/msg01075.html > If the patch is not good enough for some reasons, please post those, > with specific examples. And I'm sure we can improve it. I think it would be useful to post the actual patch here, so it can be more easily discussed, and to be easier for people who want to try it out to get to it. > > I'm not sure what you want them for. > To see how they compare performance-wise, at least. "syntax-ppss cache > is slow" was one of the big reasons for introducing the text property > cache implemented via text properties, written in C, IIRC. syntax-ppss being too slow was its use in a specific circumstance. That was trying to use it in place of comment-cache's cache mechanism, but otherwise using comment-cache. That would result in ~2 orders of magnitude slowdown in backward_comment. > So you should be able to demonstrate this stark difference in performance. That would involve hacking comment-cache, and as I've said before, would be a fruitless waste of time. With syntax-ppss we'd end up having to scan forward 10,000 characters (on average) with parse-partial-sexp just to be able to scan back over an 80 character comment. That's obvious, and not worth timing. > > The "alternative patch" didn't scan comments correctly all the time > > when I looked at it, just as the current back_comment doesn't. > Please remind us of the specific problems it has. In the following test case (same as in my other post) the "alternative patch" doesn't work. Narrow the buffer with point-min at the indicated position. Put point at EOL. Try M-: (forward-comment -1). This fails. char foo[] = "asdf asdf" "asdf"; /* "asdf" */ /* */ /* '"'" */ ^ . > > and I'll do it. Using M;- (time-scroll) from the start of xdisp.c, and (time-scroll t) from its end (having cleared caches by typing a character at BOB), I get these timings forward backward master 34.51s 36.43s comment-cache 33.68s 32.81s "alternative patch" 35.49s 36.05s (defmacro time-it (&rest forms) "Time the running of a sequence of forms using `float-time'. Call like this: \"M-: (time-it (foo ...) (bar ...) ...)\"." `(let ((start (float-time))) ,@forms (- (float-time) start))) (defun time-scroll (&optional arg) (interactive "P") (message "%s" (time-it (condition-case nil (while t (if arg (scroll-down) (scroll-up)) (sit-for 0)) (error nil))))) It would seem that differences in speed are not big enough to make any decision on that basis. -- Alan Mackenzie (Nuremberg, Germany).