[Top][All Lists]

[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 20:18:24 -0400

On Wed, Mar 15, 2017 at 4:26 PM, Stefan Monnier
<address@hidden> wrote:
> 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).

Why should one backtrack and not the other? The *2 ratio seems to hold
for both pathologically slow and normal case. Matching against a
sequence of non-trailing whitespace seens to have quadradic complexity
(see attached, timings are from an elisp buffer), does that give you
any hints?

Attachment: trailing-ws-regexp-benchmark.el
Description: Text Data

reply via email to

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