emacs-devel
[Top][All Lists]
Advanced

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

Re: [Emacs-diffs] master c66aaa6: Recomplexify ‘delete-trailing-whitespa


From: Stefan Monnier
Subject: Re: [Emacs-diffs] master c66aaa6: Recomplexify ‘delete-trailing-whitespace’ by treating \n as whitespace again
Date: Wed, 15 Mar 2017 16:26:59 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

>>>>> Recomplexify ‘delete-trailing-whitespace’ by treating \n as
>>>>> whitespace again
>>>>> Mostly reverts "Simplify ‘delete-trailing-whitespace’ by not treating
>>>>> \n as whitespace" from 2016-07-04.  Setting \n to non-whitespace
>>>>> causes the regex engine to backtrack a lot when searching for
>>>>> "\\s-+$" (Bug#26079).
>>>> Why do we use syntax-tables?
>>>> IOW why do we use \s- rather than something like [\s\t]?
>>> No clue. But (re-search-forward "[\s\t]+$" nil t) is also slow.
>> Slower than "\\s-+$"?
> No, seems to be twice as fast actually (this is still horribly slow).

I meant

   slower than the best performance of "\\s-+$"?

because "[\s\t]+$" shouldn't backtrack.  Using "\\s-+$" with
a syntax-table that puts \n in the whitespace syntax is indeed asking
for trouble, but I'm surprised "[\s\t]+$" is only twice as fast as this
pathological case (and hence presumably much slower than "\\s-+$" when
\n is not whitespace).



        Stefan




reply via email to

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