auctex-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [AUCTeX-devel] Wrap dollars around active region


From: Mosè Giordano
Subject: Re: [AUCTeX-devel] Wrap dollars around active region
Date: Thu, 6 Jun 2013 15:25:05 +0200

Hi David,

2013/6/6 David Kastrup <address@hidden>:
> 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è



reply via email to

[Prev in Thread] Current Thread [Next in Thread]