From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Reliable after-change-functions (via: Using incremental parsing in Emacs) Date: Tue, 31 Mar 2020 18:36:19 +0300 Message-ID: <83k1301qq4.fsf@gnu.org> References: <83o8sf3r7i.fsf@gnu.org> <2E218879-0F24-4A20-B210-263C8D0BEEA4@gmail.com> <838sjh2red.fsf@gnu.org> <83369o3bvb.fsf@gnu.org> <816186eb-baac-f5c7-04df-a3f30780d91d@yandex.ru> Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="56973"; mail-complaints-to="usenet@ciao.gmane.io" Cc: casouri@gmail.com, emacs-devel@gnu.org, monnier@iro.umontreal.ca, akrl@sdf.org To: Dmitry Gutov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Mar 31 17:38:10 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 1jJIxu-000EiN-D3 for ged-emacs-devel@m.gmane-mx.org; Tue, 31 Mar 2020 17:38:10 +0200 Original-Received: from localhost ([::1]:40458 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJIxt-0005lJ-C8 for ged-emacs-devel@m.gmane-mx.org; Tue, 31 Mar 2020 11:38:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35107) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJIvy-0002JZ-5c for emacs-devel@gnu.org; Tue, 31 Mar 2020 11:36:11 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:40949) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1jJIvx-0006KD-GC; Tue, 31 Mar 2020 11:36:09 -0400 Original-Received: from [176.228.60.248] (port=1976 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jJIvw-0002il-0h; Tue, 31 Mar 2020 11:36:08 -0400 In-Reply-To: <816186eb-baac-f5c7-04df-a3f30780d91d@yandex.ru> (message from Dmitry Gutov on Tue, 31 Mar 2020 17:31:43 +0300) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] 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:246112 Archived-At: > Cc: casouri@gmail.com, akrl@sdf.org, emacs-devel@gnu.org > From: Dmitry Gutov > Date: Tue, 31 Mar 2020 17:31:43 +0300 > > On 31.03.2020 16:14, Eli Zaretskii wrote: > > Why does it need the entire buffer up front? that sounds like a > > potential performance killer. Fontifying a small part of a buffer > > doesn't need its entire text. > > Because the end product of parsing the buffer is an AST, and the author > decided to minimize the odds of problems that come with > incomplete/broken ASTs. But it definitely can work with parts of the buffer, and we don't need it to have a complete AST for this particular job. > The previous (first) discussion of TreeSitter has an URL to a > presentation video. You can give it a watch. Thanks, I've watched it back in January, when I wrote my message calling for its integration. > Regarding performance, their solution is to make first parsing as fast > as possible, and updates to an existing AST faster still. I'm talking about _our_ performance, not theirs. > As for the difficulty of sending the whole buffer contents... maybe VS > Code and Atom somehow make it easier? If so, someone should investigate > why it has to be slower in Emacs. It should be obvious that sending a buffer as a single string is less efficient than letting tree-sitter access buffer text directly. We just need an appropriate API for that (maybe there is one already, I didn't take a look at their sources since January).