[Top][All Lists]

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

Re: Documentation on debugging regexp performance

From: Yuri Khan
Subject: Re: Documentation on debugging regexp performance
Date: Thu, 21 Jan 2016 12:36:34 +0600

On Thu, Jan 21, 2016 at 11:29 AM, Clément Pit--Claudel
<address@hidden> wrote:
> Hi emacs-devel,
> I'm running into a surprising regular expressions issue. I have attached a 
> file (~50k) in which (re-search-forward "   +[^:=]+ +:=?") seems to be 
> extremely slow. (I killed it after 30 seconds). Truncating the file to its 
> first 20 lines reduces the time for re-search-forward to about a second, 
> which is still extremely slow.

I’m no expert on the Emacs regexp implementation, but this part is
ambiguous: "[^:=]+ +". The engine will have to backtrack at least once
because the first part will greedily slurp all spaces, then the second
part will not match. You might want to add the space to the exclusion
character class: "[^:= ]+ +".

reply via email to

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