all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Vincenzo Pupillo <vincenzo.pupillo@lpsd.it>
To: Dmitry Gutov <dmitry@gutov.dev>, emacs-devel@gnu.org
Cc: "Ergus via Emacs development discussions." <emacs-devel@gnu.org>,
	Stefan Monnier <monnier@iro.umontreal.ca>,
	Yuan Fu <casouri@gmail.com>
Subject: Re: treesitter local parser: huge slowdown and memory usage in a long file
Date: Tue, 04 Jun 2024 10:19:30 +0200	[thread overview]
Message-ID: <3466362.LZWGnKmheA@3-191.divsi.unimi.it> (raw)
In-Reply-To: <B581DAA7-FF64-44E8-B8B1-32A0D3BFE345@gmail.com>

Thank you Yuan!
Yesterday I tried your patch with my php-ts-mode (with an without treesit-primary-parser) and works fine. 
Yesterday I pushed a commit that uses the new variable. 
When I work at home, php-ts-mode is the major-mode I use,
and is almost done (I just need to add in support for flymake). 
Next week I hope to submit it for inclusion in emacs. 
It also seems to me that it might also be useful for trying out various 
combinations of parser. 

Thanks
V.



In data martedì 4 giugno 2024 06:53:47 CEST, Yuan Fu ha scritto:
> 
> > On May 27, 2024, at 3:24 PM, Dmitry Gutov <dmitry@gutov.dev> wrote:
> > 
> > On 28/05/2024 01:03, Yuan Fu wrote:
> > 
> >>> But if one operation just changes text in that range (keeping its length intact, e.g. capitalizing the whole region), and another does the same (back to lower case), then the combined range would remain 200..300.
> >>> 
> >>> Computing that might be difficult without having access to the kinds of changes are being done (does tree-sitter report those?). OTOH, most of the time the most important part is the position of the beginning of the changes (e.g. for syntax-ppss), and we could treat the rest of the buffer as invalidated…
> >> Oh you’re absolutely right, the range will be shifted by later edits in the buffer. It’ll be hella hairy to keep track of all that—say the previous changed range is (100 . 200), and user inserted 50 chars in position 150, we need to account for that and update the range to (100 . 250) before merging the new updated ranges with this one.
> >> So it seems the best way is really to move treesit--pre-redisplay entirely into the primary parser’s notifier, WDYT?
> > 
> > Yep, that sounds easier. And the performance should be about the same, even if it'd have a bit extra overhead in those theoretical complex cases.
> > 
> 
> Ok, I pushed a commit to master that does just that. I tried with C’s block comment, and php-ts-mode. Everything seems to work fine.
> 
> I also added treesit-primary-parser. This is supposed to be another configuration variable that a major mode should set. I’ve encountered various cases where knowing the primary parser (parser that parses the entire buffer rather than just a subset of it) would be very helpful. Treesit-primary-parser can be auto-guessed if major mode doesn’t set it, so it shouldn’t break anything. I’d love to know yours and Stefan’s thoughts on it.
> 
> Yuan
> 






  reply	other threads:[~2024-06-04  8:19 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-20  2:18 treesitter local parser: huge slowdown and memory usage in a long file Yuan Fu
2024-04-20 19:14 ` Vincenzo Pupillo
2024-04-23  5:09   ` Yuan Fu
2024-05-06  2:04 ` Dmitry Gutov
2024-05-09  0:16   ` Yuan Fu
2024-05-12 23:44     ` Dmitry Gutov
2024-05-22  5:51       ` Yuan Fu
2024-05-22 23:42         ` Dmitry Gutov
2024-05-27 22:03           ` Yuan Fu
2024-05-27 22:24             ` Dmitry Gutov
2024-06-04  4:53               ` Yuan Fu
2024-06-04  8:19                 ` Vincenzo Pupillo [this message]
2024-06-04 15:01                   ` Eli Zaretskii
2024-06-04 20:44                     ` Vincenzo Pupillo
2024-06-06 23:59                 ` Dmitry Gutov
2024-06-07  0:13                   ` Dmitry Gutov
2024-06-11 16:36                     ` Yuan Fu
2024-05-26  4:23     ` Stefan Monnier via Emacs development discussions.
2024-05-27 22:05       ` Yuan Fu
2024-05-27 22:34         ` Stefan Monnier
  -- strict thread matches above, loose matches on Subject: below --
2024-02-11 21:53 Vincenzo Pupillo
2024-02-12  4:16 ` Yuan Fu
2024-02-12 14:09   ` Eli Zaretskii
2024-02-13  8:15     ` Yuan Fu
2024-02-13  9:39       ` Vincenzo Pupillo
2024-02-13 12:59       ` Eli Zaretskii
2024-02-13  0:50   ` Dmitry Gutov
2024-02-13  8:08     ` Yuan Fu
2024-02-18  3:37       ` Dmitry Gutov
2024-02-19  5:53         ` Yuan Fu
2024-03-21  6:39           ` 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

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

  git send-email \
    --in-reply-to=3466362.LZWGnKmheA@3-191.divsi.unimi.it \
    --to=vincenzo.pupillo@lpsd.it \
    --cc=casouri@gmail.com \
    --cc=dmitry@gutov.dev \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.