From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] comment-cache 223d16f 2/3: Apply `comment-depth' text properties when calling `back_comment'. Date: Sun, 13 Mar 2016 18:49:53 -0400 Message-ID: References: <20160308183010.GB6269@acm.fritz.box> <20160309174816.GE3948@acm.fritz.box> <56E0805F.3050804@gmx.at> <20160312170839.GE2572@acm.fritz.box> <20160312215839.GC10781@acm.fritz.box> <20160313175922.GE1871@acm.fritz.box> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1457909448 6362 80.91.229.3 (13 Mar 2016 22:50:48 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 13 Mar 2016 22:50:48 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Mar 13 23:50:30 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1afEq8-0006O8-5Q for ged-emacs-devel@m.gmane.org; Sun, 13 Mar 2016 23:50:24 +0100 Original-Received: from localhost ([::1]:38029 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1afEq7-00009r-LI for ged-emacs-devel@m.gmane.org; Sun, 13 Mar 2016 18:50:23 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42086) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1afEpr-00007a-50 for emacs-devel@gnu.org; Sun, 13 Mar 2016 18:50:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1afEpn-0005G2-4K for emacs-devel@gnu.org; Sun, 13 Mar 2016 18:50:07 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:48475) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1afEpm-0005FP-TG for emacs-devel@gnu.org; Sun, 13 Mar 2016 18:50:03 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1afEpl-00067k-3Q for emacs-devel@gnu.org; Sun, 13 Mar 2016 23:50:01 +0100 Original-Received: from 75-119-255-146.dsl.teksavvy.com ([75.119.255.146]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 13 Mar 2016 23:50:01 +0100 Original-Received: from monnier by 75-119-255-146.dsl.teksavvy.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 13 Mar 2016 23:50:01 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 38 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 75-119-255-146.dsl.teksavvy.com User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) Cancel-Lock: sha1:6Xx+VEtdOZUEZwf4MlwHrHk/DXQ= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:201652 Archived-At: > In branch comment-cache, on a fully fontified, and fully cached xdisp.c > buffer, there are 55786 intervals with ~557860 conses, that's an extra > 512 intervals, or less than 1%. There are an extra ~115668 conses, > about an extra 25%. I'll admit this is a drawback. There's also the extra cost of applying all those text-properties plus the cost of slowing down application of other text-properties (since every time we modify intervals, we have to play with the lists of properties of the intervals involved), plus the cost of slowing down all lookups of other text-properties. These were some of the reasons which made me choose a separate table for syntax-ppss rather than using text-properties. This said, I don't think it matters much. FWIW, syntax-ppss uses a very naive singly-linked list for the simple reason that I decided to "first get something working", and I just haven't found a need to go back and optimize this data-structure (which could be turned into a tree or even an array, in case it mattered). Another motivation to go with a separate table was that I figured I would then be able to more easily manipulate the cache, e.g. in case I wanted to keep several versions of the cache at the same time (e.g. one version per syntax-table value being used, or one version per value of `point-min'). But there again, I haven't had the need to go back and add that kind of functionality yet. IOW, I don't think the exact representation chosen matters much. What I do think is a pity in your implementation (thinking of it as a potential replacement for syntax-ppss) is that it has to do all the hard work of computing a full "parse-partial-sexp state" (aka PPSS) and then throws away the parenthesis part of the state to only keep the string/comment part, making it unable to provide as much info as syntax-ppss does, even though it had to work just as hard for it. Stefan