From: Ralf Angeli <angeli@caeruleus.net>
Subject: Progressively slow pattern match
Date: Wed, 17 May 2006 21:33:18 +0200 [thread overview]
Message-ID: <87ejysbg5d.fsf@neutrino.caeruleus.net> (raw)
In AUCTeX there is a regexp used with `looking-at' where pattern
matching seems to progressively get slower the longer a part of the
(possible) match gets. I reduced the regexp to a bare minimum for
testing and the code now looks something like this:
(looking-at "\\(%+\\)*foo")
The problem occurs if this is used against a line with only %
characters in it. The more of these characters there are the slower
it gets. I checked the time one call of `looking-at' takes with
(abs (- (float-time) (progn (looking-at "\\(%+\\)*foo") (float-time))))
and got the following results (in seconds):
%%%%%%%%%% 0.0006
%%%%%%%%%%%%%%% 0.0154
%%%%%%%%%%%%%%%%%%%% 0.5132
%%%%%%%%%%%%%%%%%%%%%%%%% 7.8058
The regexp is used with `looking-at' for checking if there are LaTeX
macros which have to be treated specially during paragraph movement.
As paragraph movement is used quite extensively when a region is to be
filled, users might get the notion that they are experiencing a hang
if they have such line for visually separating parts in the file.
Is this a deficiency in Emacs? Is there a way matching can be sped up
with this or maybe another, equivalent regexp?
--
Ralf
next reply other threads:[~2006-05-17 19:33 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-05-17 19:33 Ralf Angeli [this message]
2006-05-17 19:37 ` Progressively slow pattern match David Kastrup
2006-05-17 19:50 ` Kevin Rodgers
2006-05-17 19:50 ` Ralf Angeli
2006-05-17 20:00 ` Alan Mackenzie
2006-05-17 21:13 ` Ralf Angeli
2006-05-17 20:04 ` David Kastrup
2006-05-17 20:21 ` Stuart D. Herring
2006-05-17 19:53 ` Alan Mackenzie
2006-05-17 23:13 ` Richard Stallman
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=87ejysbg5d.fsf@neutrino.caeruleus.net \
--to=angeli@caeruleus.net \
/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.