all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Noam Postavsky <npostavs@users.sourceforge.net>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Emacs developers <emacs-devel@gnu.org>
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	[thread overview]
Message-ID: <CAM-tV-9W1xPcwBmTZ9JGbKRuL6AKXR5E7OaFayGx-OLtCU+hLQ@mail.gmail.com> (raw)
In-Reply-To: <jwvzigmzjcs.fsf-monnier+gmane.emacs.devel@gnu.org>

On Wed, Mar 15, 2017 at 10:50 AM, Stefan Monnier
<monnier@iro.umontreal.ca> 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	other threads:[~2017-03-15 17:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20170315023157.29463.36647@vcs0.savannah.gnu.org>
     [not found] ` <20170315023159.30AA520CAB@vcs0.savannah.gnu.org>
2017-03-15 11:28   ` [Emacs-diffs] master c66aaa6: Recomplexify ‘delete-trailing-whitespace’ by treating \n as whitespace again Stefan Monnier
2017-03-15 12:09     ` Noam Postavsky
2017-03-15 14:50       ` Stefan Monnier
2017-03-15 17:05         ` Noam Postavsky [this message]
2017-03-15 20:26           ` Stefan Monnier
2017-03-16  0:18             ` Noam Postavsky
2017-03-16  2:52               ` Stefan Monnier
2017-03-16  3:04                 ` Noam Postavsky
2017-03-16  3:08                   ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAM-tV-9W1xPcwBmTZ9JGbKRuL6AKXR5E7OaFayGx-OLtCU+hLQ@mail.gmail.com \
    --to=npostavs@users.sourceforge.net \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.