unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Fu Yuan <casouri@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: jostein@kjonigsen.net,
	"Ergus via Emacs development discussions." <emacs-devel@gnu.org>,
	"Tuấn-Anh Nguyễn" <ubolonton@gmail.com>,
	"Markus Triska" <markus.triska@gmx.at>,
	"Theodor Thornhill" <theo@thornhill.no>,
	dgutov@yandex.ru
Subject: Re: Tree-sitter integration on feature/tree-sitter (severe performance issues together with linum-mode)
Date: Mon, 22 Aug 2022 18:53:10 -0700	[thread overview]
Message-ID: <04E35325-9A74-4395-9C93-2300827494C4@gmail.com> (raw)
In-Reply-To: <jwvpmgv2elt.fsf-monnier+emacs@gnu.org>


> 
> Yuan Fu [2022-08-19 14:58:49] wrote:
> 
>>>> On Aug 18, 2022, at 11:01 PM, Jostein Kjønigsen <jostein@secure.kjonigsen.net> wrote:
>>> 
>>> On 18.08.2022 11:44, Yuan Fu wrote:
>>>> 
>>>> Good news, the slowness can be easily resolved by compiling the query
>>>> pattern in csharp-mode-font-lock-settings-1 (this is a recent addition to
>>>> treesit).
>>>> 
>>>> Yuan
>>>> 
>>> Thanks for the reply and thanks for looking into this.
>>> 
>>> I can confirm that by compiling the query like you suggested, and
>>> replacing linum-mode with nlinum-mode, I'm not experiencing any
>>> performance issues any more!
>>> 
>>> To avoid issues like this... Should perhaps the function
>>> treesit-query-capture (in treesit.c) emit a warning/message when
>>> encountering non-compiled queries?
>>> 
>>> That way writing more performant major-modes would be more
>>> self-explanatory, resulting in a better, faster Emacs for everyone.
>> 
>> Warning/message seems a bit drastic. There are valid use-cases where one
>> want to use an uncompiled query. For now I have words in the docstring that
>> advices using compiled queries (albeit not in all caps :-)
> 
> FWIW, I think specifying the highlighting rules with something akin to:
> 
>    (defvar <foo> '<rules>)
> 
> is a mistake.  It should go through some kind of macro, such as (maybe):
> 
>    (defvar <foo> (tree-sitter-rules <rules>))
> 
> which can thus do any preprocessing we may want, such as pre-compiling
> queries.  It also helps evolve the syntax since we can more easily warn
> about obsolete uses, etc...
> 
> I've had a "rewrite font-lock.el so the rules go through a macro" in my
> todo list for ages.

Yeah! I can do that. Do you have some ideas on the syntax you would use for font-lock? If possible I’d like treesit stuff to be similar to font-lock. For example I made treesit to use font-lock’s decoration level system.

Yuan


  reply	other threads:[~2022-08-23  1:53 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-15 12:32 Tree-sitter integration on feature/tree-sitter (severe performance issues together with linum-mode) Jostein Kjønigsen
2022-08-15 12:50 ` Dmitry Gutov
2022-08-15 13:53 ` Stefan Monnier
2022-08-18  7:50   ` Yuan Fu
2022-08-18  9:44 ` Yuan Fu
2022-08-19  6:01   ` Jostein Kjønigsen
2022-08-19 21:58     ` Yuan Fu
2022-08-20 14:14       ` Stefan Monnier
2022-08-23  1:53         ` Fu Yuan [this message]
2022-08-23 14:30           ` Stefan Monnier
2022-08-24  1:18             ` John Yates
2022-09-06  2:53         ` Clément Pit-Claudel
2022-09-06  4:44           ` Macros considered harmful (was: Tree-sitter integration on feature/tree-sitter (severe performance issues together with linum-mode)) Stefan Monnier
2022-09-06 15:33             ` Macros considered harmful Basil L. Contovounesios
2022-09-06 16:01               ` Stefan Monnier
2022-11-03 18:27                 ` Basil L. Contovounesios
2022-09-06 16:13               ` Philip Kaludercic
2022-09-06 16:54               ` T.V Raman
2022-09-07  0:41           ` Tree-sitter integration on feature/tree-sitter (severe performance issues together with linum-mode) Yuan Fu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=04E35325-9A74-4395-9C93-2300827494C4@gmail.com \
    --to=casouri@gmail.com \
    --cc=dgutov@yandex.ru \
    --cc=emacs-devel@gnu.org \
    --cc=jostein@kjonigsen.net \
    --cc=markus.triska@gmx.at \
    --cc=monnier@iro.umontreal.ca \
    --cc=theo@thornhill.no \
    --cc=ubolonton@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).