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: Noam Postavsky
Subject: Re: [Emacs-diffs] master c66aaa6: Recomplexify ‘delete-trailing-whitespace’ by treating \n as whitespace again
Date: Wed, 15 Mar 2017 13:05:59 -0400

On Wed, Mar 15, 2017 at 10:50 AM, Stefan Monnier
<address@hidden> wrote:
>>>> 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).
On the test file given in Bug#26079[1]

(benchmark 1 '(re-search-forward "[\s\t]+$" nil t)) ;=> Elapsed time: 9.944000s
(benchmark 1 '(save-excursion
        (let ((end-marker nil))
          (goto-char (point-min))
          (with-syntax-table (make-syntax-table (syntax-table))
            (modify-syntax-entry ?\f "_")
            (modify-syntax-entry ?\n "_")
            (re-search-forward "\\s-+$" end-marker t))))) ;=> Elapsed
time: 20.496000s

[1]: 
https://raw.githubusercontent.com/stakemori/e8theta_degree3/master/results/wt18_17_5/wt18_17_5.org



reply via email to

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