From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Reliable after-change-functions (via: Using incremental parsing in Emacs) Date: Thu, 02 Apr 2020 11:19:33 -0400 Message-ID: References: <83369o1khx.fsf@gnu.org> <83imijz68s.fsf@gnu.org> <831rp7ypam.fsf@gnu.org> <86wo6yhj4d.fsf@stephe-leake.org> <83o8sax803.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="14407"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: stephen_leake@stephe-leake.org, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Apr 02 17:20:31 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jK1du-0003eb-VF for ged-emacs-devel@m.gmane-mx.org; Thu, 02 Apr 2020 17:20:30 +0200 Original-Received: from localhost ([::1]:43190 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jK1du-0001Kp-15 for ged-emacs-devel@m.gmane-mx.org; Thu, 02 Apr 2020 11:20:30 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48900) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jK1d6-0000NZ-EK for emacs-devel@gnu.org; Thu, 02 Apr 2020 11:19:42 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jK1d4-00023n-RP for emacs-devel@gnu.org; Thu, 02 Apr 2020 11:19:39 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:12626) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jK1d3-00022s-9C; Thu, 02 Apr 2020 11:19:37 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 1C01744FB90; Thu, 2 Apr 2020 11:19:36 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 6ED1144FB89; Thu, 2 Apr 2020 11:19:34 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1585840774; bh=JtxeiRv27x928CS45n6NNvy1bMknDwVqZwRs3SF64YA=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=cXIqMx/mI+VrlkYLl9BPGMUIuqDWPs1HLrVl3BiDf//df/s8SsOCzuCH0qbcdBbfn rpvLlmaf2pWmBsktscw+aBi6TwIoDSneX2xSgYStWAESOVbzHFurahg/ouxI1+186J nqApwxvteDu+KqrMhT0UpYppf7I+dXqgm2AFSqYiWQRys6pcDGuXzJ/GIqbmecEg7V 2vslHc0OzJZPs2fPeWBX32r+xTbAZnU0tsDeUF585QIrwjKRCaD4U7FYjafOR8QzGE NwVBpr/nvvD1bQJ0Rty+R5Po2lKd8mFM/ogwe9stMXzULdlLBscvLiGTqLIwMVevgK oltc73caSeQVQ== Original-Received: from alfajor (unknown [104.247.241.114]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 173331208C0; Thu, 2 Apr 2020 11:19:34 -0400 (EDT) In-Reply-To: <83o8sax803.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 02 Apr 2020 17:44:12 +0300") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 132.204.25.50 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:246266 Archived-At: > I think we should try to avoid both copying and encoding the text we > send to the parser. Both operations are expensive and require memory > allocation. I think both operations are cheap enough relatively to the actual parsing that it is not indispensable to avoid them: maybe it will be worth the effort, but maybe not. In any case, it's a minor implementation detail that can easily be changed in the future without impacting the rest of the code. So, I think it falls squarely in the realm of premature optimization. >> According to https://github.com/tree-sitter/tree-sitter/issues/222 the >> parse tree takes around 10 times the size of the source text. > Yes, that's another reason why it might make sense to "forget" trees > of buffers that were not displayed for a long time. Agreed, tho I wouldn't word it that way: parse trees are not needed for redisplay and can be used for things that don't relate to redisplay (e.g. navigation, indentation, ...). > But this is an optimization that can be added later without any > significant changes in the design. Agreed as well. Stefan