GNU bug report logs - #58558
29.0.50; re-search-forward is slow in some buffers

Previous Next

Package: emacs;

Reported by: Ihor Radchenko <yantar92 <at> posteo.net>

Date: Sun, 16 Oct 2022 01:27:02 UTC

Severity: normal

Found in version 29.0.50

Full log


Message #212 received at 58558 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Ihor Radchenko <yantar92 <at> posteo.net>
Cc: 58558 <at> debbugs.gnu.org, Alan Mackenzie <acm <at> muc.de>,
 Eli Zaretskii <eliz <at> gnu.org>, larsi <at> gnus.org
Subject: Re: bug#58558: 29.0.50; re-search-forward is slow in some buffers
Date: Wed, 12 Apr 2023 11:20:17 -0400
> I confirm that it does fix the problem. But why not `with-temp-buffer'?

I think it's for compatibility with TECO Emacs or something like that :-)

> Also, how come `setq' changes the global variable value despite it is
> let-bound?

Because the `let` and the `setq` were not performed in the same buffer,
so if the var is buffer-local ...

> To improve the performance, the two obvious ways are reducing the number
> of SYNTAX_TABLE_BYTE_TO_CHAR calls in re_match_2_internal and speeding
> up buf_bytepos_to_charpos.

I think the behavior you experience doesn't require "speeding up" but it
requires "fixing a performance bug".  Technically it's the same, but still..

> I'd prefer the latter as it is used ubiquitously across Emacs and
> making point lookup faster will thus benefit other places as well.

Why choose?

For the former, we could probably extend the `b_property` and
`e_property` fields of `gl_state` (which hold charpos) to also store
their bytepos equivalent, which should significantly reduce the number
of conversions between bytepos and charpos.


        Stefan







This bug report was last modified 2 years and 64 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.