From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.devel Subject: Re: Tree-sitter api Date: Sat, 25 Dec 2021 00:31:26 -0800 Message-ID: <0BB906F7-BD3A-41CC-9783-19AA16934497@gmail.com> References: <9C5A86D6-0E7D-4DDF-B211-278EF9AC7E01@gmail.com> <87a6gq5mxl.fsf@gmail.com> <877dbu5mgj.fsf@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 15.0 \(3693.40.0.1.81\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28822"; mail-complaints-to="usenet@ciao.gmane.io" Cc: =?utf-8?Q?Cl=C3=A9ment_Pit-Claudel?= , Theodor Thornhill , ubolonton@gmail.com, Emacs developers , Philipp , Stefan Monnier , Eli Zaretskii , Stephen Leake , John Yates To: Yoav Marco Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Dec 25 09:32:24 2021 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 1n12TY-0007JN-9W for ged-emacs-devel@m.gmane-mx.org; Sat, 25 Dec 2021 09:32:24 +0100 Original-Received: from localhost ([::1]:50344 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n12TW-0006JW-3P for ged-emacs-devel@m.gmane-mx.org; Sat, 25 Dec 2021 03:32:22 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:52094) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n12Si-0005ct-2f for emacs-devel@gnu.org; Sat, 25 Dec 2021 03:31:32 -0500 Original-Received: from [2607:f8b0:4864:20::435] (port=43732 helo=mail-pf1-x435.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n12Sg-0006Fm-H1; Sat, 25 Dec 2021 03:31:31 -0500 Original-Received: by mail-pf1-x435.google.com with SMTP id 196so9380913pfw.10; Sat, 25 Dec 2021 00:31:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=YS/yBOsJaUhLqUBxQwOzgWCkTbrzOR7w8Sxx7ybPi7o=; b=Am6ytQPMQbb7j+L5BSMggntzL6eeyNh976p1OLXW9VKPDsX5lO0C32xh2Cy36UDdFO D6V2oJyG+5OOaOgQCcaaVHOTnTw2znaOdI9WO0S02VM57iz6Yh2SoOj3P0Yu4bEZBwqT PuUQGYjeUKoG5EzVyQRgMpqefkym0lPlkjmFtILC1A1OZDwq8O48opNBNplnAKHstEF7 ezZ3aR/AAWqpnIcWIwQ7PWu6D5Fo/I/84SyAzf1cwzZTUbFYVA+c8DEUvWjeZm+NLzg0 FrfGamIbjgMt+33jbvJojqrhTctMInIqRG9h/R8nmrP4/GhhFvOlFmfR5Nvul7Uxvysj yflA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=YS/yBOsJaUhLqUBxQwOzgWCkTbrzOR7w8Sxx7ybPi7o=; b=stpzcGiuD3THyCR9vUgYZRfR2X4JEdByGUmzBGRaRa1kHHRnN+QMKrtRiP6RCySrQP lbla6nc5UHhXtmFZgQgmQnPlLyJwr3Lk8GzOwoo6t5BopWZ2ZCwlYv6Xn420C119fosb Pt5DUhfrW4WQ34A7rGP0sYPUwJS6reffcaYNhXeQEzYYkIZjNGRx0U88tckSBnt8O62P yKjjw9M0NaLp9SrMI3qvDIAp2+oZsmhaZG7p2jtnyiKZ2C/9QE3lO0puIfRK8aVd0k9t 0TLKC5+pZtp2Fi7RMbWcqnXWvcDKCwyDMt8cqE9FBcuItuelfS11h1ndP3gx3jIkXCQF Yyug== X-Gm-Message-State: AOAM533w5IFayp15VLD8kiqUa94FUXq7fyWokroLXz0O33Turnnepgkw rg9X3K0icMqr6gLUeT4B7Wk= X-Google-Smtp-Source: ABdhPJztGZv3Y1JDCSQ7H3NcPDBChQjuXiOIALHP8DSgJzi8JlA2GpYAzNEjWmr8UR2KHw9pjBQwfA== X-Received: by 2002:a63:fe10:: with SMTP id p16mr8612903pgh.546.1640421088258; Sat, 25 Dec 2021 00:31:28 -0800 (PST) Original-Received: from smtpclient.apple ([2600:1700:2ec7:8c90:4996:7518:72cc:91b0]) by smtp.gmail.com with ESMTPSA id q2sm11609364pfj.62.2021.12.25.00.31.27 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 25 Dec 2021 00:31:27 -0800 (PST) In-Reply-To: <877dbu5mgj.fsf@gmail.com> X-Mailer: Apple Mail (2.3693.40.0.1.81) X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::435 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::435; envelope-from=casouri@gmail.com; helo=mail-pf1-x435.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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:283189 Archived-At: > On Dec 24, 2021, at 2:21 AM, Yoav Marco wrote: >=20 >=20 >=20 >> Yuan Fu writes: >>> I can see some advantages to compile the query ahead of time. 1) It = would be >>> helpful to know there is an error before calling >>> tree-sitter-font-lock-fontify-region and see an unfontified buffer, = not >>> knowing what went wrong. I can add a function, say, = tree-sitter-compile-query >>> that checks a query (as in query pattern) and passes it on if its = correct. 2) >>> It could potentially saves recompilation of the query. But computing = the query >>> most probably takes negligible time. >=20 > I'll try to benchmark it. Would be great if it really is nothing. Sounds good, thanks. Eli, is there any profiling primitives in Emacs? = How do you usually profile Emacs?=20 Yuan=