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: Wed, 01 Apr 2020 16:26:59 +0300 Message-ID: <83imijz68s.fsf@gnu.org> References: <83369o1khx.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="100691"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: =?utf-8?Q?Tu=E1=BA=A5n?= Anh =?utf-8?Q?Nguy=E1=BB=85n?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Apr 01 15:27:18 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 1jJdOo-000Q4O-K0 for ged-emacs-devel@m.gmane-mx.org; Wed, 01 Apr 2020 15:27:18 +0200 Original-Received: from localhost ([::1]:60342 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJdOn-0002ip-Mg for ged-emacs-devel@m.gmane-mx.org; Wed, 01 Apr 2020 09:27:17 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38347) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJdOI-0002HD-5V for emacs-devel@gnu.org; Wed, 01 Apr 2020 09:26:47 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:60973) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1jJdOH-00034U-WF; Wed, 01 Apr 2020 09:26:46 -0400 Original-Received: from [176.228.60.248] (port=2266 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jJdOG-0004wy-Ci; Wed, 01 Apr 2020 09:26:44 -0400 In-Reply-To: (message from =?utf-8?Q?Tu=E1=BA=A5n?= Anh =?utf-8?Q?Nguy=E1=BB=85n?= on Wed, 1 Apr 2020 13:17:42 +0700) 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:246189 Archived-At: > From: Tuấn Anh Nguyễn > Date: Wed, 1 Apr 2020 13:17:42 +0700 > Cc: emacs-devel@gnu.org > > Real usage with "xdisp.c": > > (define-advice tree-sitter--do-parse (:around (f &rest args) benchmark) > (message "%s" (benchmark-run (apply f args)))) > > (0.257998 1 0.13326100000000096) And that is even without encoding the buffer text, IIUC what the package does. > So yes, direct access to buffer's text from dynamic modules would be nice. Did you consider using the API where an application can provide a function to return text at a given offset? Such a function could be relatively easily implemented for Emacs. Btw, what do you do with the tree returned by the tree-sitter parser? store it in some buffer-local variable? If so, how much memory does such a tree take, and when, if ever, is that memory released?