From: Yuan Fu <casouri@gmail.com>
To: jostein@kjonigsen.net
Cc: "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>
Subject: Re: Tree-sitter integration on feature/tree-sitter (severe performance issues together with linum-mode)
Date: Thu, 18 Aug 2022 02:44:47 -0700 [thread overview]
Message-ID: <D3BA9860-0E41-4646-AAD2-CB067BFC1EAA@gmail.com> (raw)
In-Reply-To: <7e24d0aa-9980-6204-5064-5a92963ae7bd@secure.kjonigsen.net>
>
> Can something be done to Yuan's code to make it perform equally to Thuan-Anh's? Are there improvements which can be done to linum-mode to avoid these kinds of issues?
>
> I know for sure I'm not qualified to answer those questions, but I think it's definitely something which needs to be looked into and if anyone has anything they want me to provide feedback on though, I will be more than happy test those changes and report back.
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). I guess typescript-mode’s query pattern is short enough to not bog down font-locking, but C#’s relatively large set of patterns makes query captures very slow.
I changed
(setq csharp-mode-font-lock-settings-1
`((c-sharp
(
;; Various constructs
(comment) @font-lock-comment-face
(modifier) @font-lock-keyword-face
(this_expression) @font-lock-keyword-face
(escape_sequence) @font-lock-keyword-face
…
to
(setq csharp-mode-font-lock-settings-1
`((c-sharp
,(treesit-query-compile
'c-sharp
'(
;; Various constructs
(comment) @font-lock-comment-face
(modifier) @font-lock-keyword-face
(this_expression) @font-lock-keyword-face
(escape_sequence) @font-lock-keyword-face
…
And now csharp-mode is pretty fast!
Yuan
next prev parent reply other threads:[~2022-08-18 9:44 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 [this message]
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
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=D3BA9860-0E41-4646-AAD2-CB067BFC1EAA@gmail.com \
--to=casouri@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=jostein@kjonigsen.net \
--cc=markus.triska@gmx.at \
--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).