Hi David,

2013/6/6 David Kastrup <d...@gnu.org>:
> The real contraindication is that it includes any ending delimiter, so
> any patterns including it will match until the end of file and cause
> slow matching.  One should only use it in non-greedy parts of the
> pattern.
In my code the regex search is bound from point to mark, I don't
believe it reaches the end of the buffer.  To verify this I carried
out some tests on a ~200 MiB file created with
    $ yes > verylargefile
It takes less than a second (`benchmark-run' actually says less than a
millisecond) to perform the regex search "[^z-a]*" when the search is
restricted to some thousands of characters, while it takes ~15 seconds
when the search is performed up to the end of the buffer.

BTW, rough tests with `benchmark-run' also say "[^z-a]*" is about
twice as fast as "\(?:.\|\n\)*", I suppose because "\(?:.\|\n\)*" has
to check two alternatives.

I hope no one will ever use `TeX-insert-dollar' on a region longer
than some dozens of characters, there should be no performance issues
whatever the length of the whole buffer.

Bye,
Mosè

_______________________________________________
auctex-devel mailing list
auctex-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/auctex-devel

Reply via email to