From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: =?UTF-8?B?VHXhuqVuIEFuaCBOZ3V54buFbg==?= Newsgroups: gmane.emacs.devel Subject: Re: Reliable after-change-functions (via: Using incremental parsing in Emacs) Date: Wed, 1 Apr 2020 13:17:42 +0700 Message-ID: References: <83369o1khx.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="00000000000075d14205a234a52f" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="67522"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Apr 01 08:19:01 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 1jJWiH-000HOs-La for ged-emacs-devel@m.gmane-mx.org; Wed, 01 Apr 2020 08:18:57 +0200 Original-Received: from localhost ([::1]:47448 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJWiG-0001xb-OC for ged-emacs-devel@m.gmane-mx.org; Wed, 01 Apr 2020 02:18:56 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49833) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJWhU-0001WG-Nd for emacs-devel@gnu.org; Wed, 01 Apr 2020 02:18:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jJWhS-0006ry-Md for emacs-devel@gnu.org; Wed, 01 Apr 2020 02:18:08 -0400 Original-Received: from mail-pj1-x1041.google.com ([2607:f8b0:4864:20::1041]:33569) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jJWhP-0006jL-Fq; Wed, 01 Apr 2020 02:18:03 -0400 Original-Received: by mail-pj1-x1041.google.com with SMTP id jz1so1818452pjb.0; Tue, 31 Mar 2020 23:18:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=pKtw26s0BWNo2Spf2P6ZSiR7GKAgpphwxDizXMdscSI=; b=DFiiez5pGGd9xeZPRT4Of3woYQ62C2GRNGfH46yHVSq4i1UDJdvIwpLXBDo/SFbUjD NlYUzSWTZoI2ba0N2YkGSWKySJtB/G8Fss8ms1uvO9qWMChGr4sqPgqKaXW/dG55rLN+ e9hAiAulNTj4ZoNqH9ZAXfflJubjv2VC1dB4OBGKvKhxtleG2PvDeDY8ymKZRO/pnZFU JA6kCtIO7SMEtRMQsU9B/jTsWq48nbtmIjKKfmwLQ/qZ8kZ94FZBY8SBsa+1HH+dExvd K1BmT3is9nd5rI4pHfdKBp9+yej6c+JXok2LrBPukSCUCSsasGa1XwA8Sv9sL7VxLOfH MFaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=pKtw26s0BWNo2Spf2P6ZSiR7GKAgpphwxDizXMdscSI=; b=e+uA5PZbueUKosnW4Ti0+gBTXwa992t98t08VRqbpZxBn0YQcE+n7FWkAlSvZ3mxTi x+nHa/2uj6SC3f7TMbD5EuMQ5xmbu2XU0Qp4ucLEVcwWSm0gdCTCPCpfm/Ry43DByxPE kkk971jsjqGBqU9BF6H205rpaFgfwxrQC00DgNHTdJE0qLOsishm9MjwdenCx8c+msA/ gZHOptpg1Z7hOnBNU0yCUE3p9Y+jX5gBzCEqXzCuRh9m11ws7mSjcCYeO3k2V9z1iaCW CfuIp84DIysHWBRoHbW/Rgb9fbtYN6DgcgzbFmzzoRs4d4aPBYaIK96uVV/CdHj2p2L9 ZWLg== X-Gm-Message-State: AGi0Pua4hwJIeCwDlsQSMfW5g6jJX4xLVVv2QDf4Z91eYeuqdMAXI6a3 ZXkbJ+yJVeGe5WMZ1KN1FdNMR5AW0IWO73ze+UtlyrRJhY/Xuw== X-Google-Smtp-Source: APiQypIp4Nyzts7PnfjvtxQDKz746VlJDNS3REOtJKIaeQnVDLBLJL4vzzzIu8ZYWj2upYPDDMlzZk7e+jCsBpCts1Y= X-Received: by 2002:a17:902:9305:: with SMTP id bc5mr6135474plb.127.1585721881513; Tue, 31 Mar 2020 23:18:01 -0700 (PDT) In-Reply-To: <83369o1khx.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::1041 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:246183 Archived-At: --00000000000075d14205a234a52f Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Apr 1, 2020 at 12:50 AM Eli Zaretskii wrote: > > From: Tu=E1=BA=A5n Anh Nguy=E1=BB=85n > > Date: Wed, 1 Apr 2020 00:07:27 +0700 > > > > > xdisp.c comes to mind, obviously. > > > > On my machine, a 3.39 GHz Intel Core i7: > > > > (0.150791 0 0.0) ; 1 full parse > > How did you submit xdisp.c to the parser? > (with-current-buffer "xdisp.c" (let ((language (tree-sitter-require 'c)) (parser (ts-make-parser))) (ts-set-language parser language) (garbage-collect) (message "%s" (benchmark-run (ts-parse parser #'ts-buffer-input nil))))) > In any case, IIUC, the first time a buffer needs to be displayed, we > need to wait for these 150 msec? That's annoyingly long (and I > suspect in real Emacs usage will be significantly longer, due to > memory allocation, encoding, etc.). > 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) So yes, direct access to buffer's text from dynamic modules would be nice. -- Tu=E1=BA=A5n-Anh Nguy=E1=BB=85n Software Engineer --00000000000075d14205a234a52f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Wed, Apr 1, 2020 at 12:50 AM Eli Z= aretskii <eliz@gnu.org> wrote:
> From: Tu=E1= =BA=A5n Anh Nguy=E1=BB=85n <ubolonton@gmail.com>
> Date: Wed, 1 Apr 2020 00:07:27 +0700
>
> > xdisp.c comes to mind, obviously.
>
> On my machine, a 3.39 GHz Intel Core i7:
>
>=C2=A0 =C2=A0 =C2=A0(0.150791 0 0.0) ; 1 full parse

How did you submit xdisp.c to the parser?
=C2=A0
=
=C2=A0 =C2=A0 (with-current-buffer "xdisp.c"
=C2=A0 =C2= =A0 =C2=A0 (let ((language (tree-sitter-require 'c))
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 (parser (ts-make-parser)))
=C2=A0 =C2=A0 =C2= =A0 =C2=A0 (ts-set-language parser language)
=C2=A0 =C2=A0 =C2=A0 =C2=A0= (garbage-collect)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (message "%s" (= benchmark-run (ts-parse parser #'ts-buffer-input nil)))))

In any case, IIUC, the first time a buffer needs to be displayed, we
need to wait for these 150 msec?=C2=A0 That's annoyingly long (and I suspect in real Emacs usage will be significantly longer, due to
memory allocation, encoding, etc.).

Real usage with "xdisp.c":=

=C2=A0 =C2=A0 (define-advice tree-sitter--do-parse= (:around (f &rest args) benchmark)
=C2=A0 =C2=A0 =C2=A0 (message &q= uot;%s" (benchmark-run (apply f args))))

=C2=A0 =C2=A0 (0.25799= 8 1 0.13326100000000096)

So yes, direct access to bu= ffer's text from dynamic modules would be nice.

<= div>--
Tu=E1=BA=A5n-Anh Nguy=E1=BB=85n
Software En= gineer

--00000000000075d14205a234a52f--