unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: emacs-29 f711f4e99f7: (Ftreesit_query_capture): Cache list of predicates for given pattern index
       [not found] ` <20230201014614.30165C00613@vcs2.savannah.gnu.org>
@ 2023-02-01  3:48   ` Po Lu
  2023-02-01 10:18     ` Dmitry Gutov
  0 siblings, 1 reply; 3+ messages in thread
From: Po Lu @ 2023-02-01  3:48 UTC (permalink / raw)
  To: emacs-devel; +Cc: Dmitry Gutov

Dmitry Gutov <dgutov@yandex.ru> writes:

> branch: emacs-29
> commit f711f4e99f7f2b213e70d14c808261b93ed10c36
> Author: Dmitry Gutov <dgutov@yandex.ru>
> Commit: Dmitry Gutov <dgutov@yandex.ru>
>
>     (Ftreesit_query_capture): Cache list of predicates for given pattern index
>     
>     * src/treesit.c (Ftreesit_query_capture):
>     Cache list of predicates for given pattern index (bug#60953).
> ---
>  src/treesit.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/src/treesit.c b/src/treesit.c
> index b210ec0923a..a5815903b4d 100644
> --- a/src/treesit.c
> +++ b/src/treesit.c
> @@ -2720,8 +2720,10 @@ the query.  */)
>       every for loop and nconc it to RESULT every time.  That is indeed
>       the initial implementation in which Yoav found nconc being the
>       bottleneck (98.4% of the running time spent on nconc).  */
> +  uint32_t patterns_count = ts_query_pattern_count (treesit_query);
>    Lisp_Object result = Qnil;
>    Lisp_Object prev_result = result;
> +  Lisp_Object predicates_table = make_vector (patterns_count, Qt);
>    while (ts_query_cursor_next_match (cursor, &match))
>      {
>        /* Record the checkpoint that we may roll back to.  */
> @@ -2750,9 +2752,12 @@ the query.  */)
>  	  result = Fcons (cap, result);
>  	}
>        /* Get predicates.  */
> -      Lisp_Object predicates
> -	= treesit_predicates_for_pattern (treesit_query,
> -					  match.pattern_index);
> +      Lisp_Object predicates = AREF (predicates_table, match.pattern_index);
> +      if (EQ (predicates, Qt))
> +	{
> +	  predicates = treesit_predicates_for_pattern (treesit_query, 0);
> +	  ASET (predicates_table, match.pattern_index, predicates);
> +	}
>  
>        /* captures_lisp = Fnreverse (captures_lisp); */
>        struct capture_range captures_range = { result, prev_result };

Is this not a rather big change for the release branch, so close to the
pretest?



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: emacs-29 f711f4e99f7: (Ftreesit_query_capture): Cache list of predicates for given pattern index
  2023-02-01  3:48   ` emacs-29 f711f4e99f7: (Ftreesit_query_capture): Cache list of predicates for given pattern index Po Lu
@ 2023-02-01 10:18     ` Dmitry Gutov
  2023-02-01 23:20       ` Yuan Fu
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Gutov @ 2023-02-01 10:18 UTC (permalink / raw)
  To: Po Lu, emacs-devel

On 01/02/2023 05:48, Po Lu wrote:
> Is this not a rather big change for the release branch, so close to the
> pretest?

I don't think so. It's a straightforward change, fix for a problem 
that's been under discussion for a while.

Furthermore, it only affects TS modes, which have been granted an exception.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: emacs-29 f711f4e99f7: (Ftreesit_query_capture): Cache list of predicates for given pattern index
  2023-02-01 10:18     ` Dmitry Gutov
@ 2023-02-01 23:20       ` Yuan Fu
  0 siblings, 0 replies; 3+ messages in thread
From: Yuan Fu @ 2023-02-01 23:20 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: Po Lu, emacs-devel



> On Feb 1, 2023, at 2:18 AM, Dmitry Gutov <dgutov@yandex.ru> wrote:
> 
> On 01/02/2023 05:48, Po Lu wrote:
>> Is this not a rather big change for the release branch, so close to the
>> pretest?
> 
> I don't think so. It's a straightforward change, fix for a problem that's been under discussion for a while.
> 
> Furthermore, it only affects TS modes, which have been granted an exception.

I don’t have an opinion on the matter, but tree-sitter’s exception has expired, FYI ;-)

Yuan


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-02-01 23:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <167521597129.3087.11030300860591714532@vcs2.savannah.gnu.org>
     [not found] ` <20230201014614.30165C00613@vcs2.savannah.gnu.org>
2023-02-01  3:48   ` emacs-29 f711f4e99f7: (Ftreesit_query_capture): Cache list of predicates for given pattern index Po Lu
2023-02-01 10:18     ` Dmitry Gutov
2023-02-01 23:20       ` Yuan Fu

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).