[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Any performance comparison/guide of/for Emacs regex?
From: |
Stefan Monnier |
Subject: |
Re: Any performance comparison/guide of/for Emacs regex? |
Date: |
Tue, 18 Jan 2011 20:22:01 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
>> Not really. What you need to know is that Emacs's regexp engine is
>> based on backtracking, so things like .*\\(.*\\).* is insanely
>> inefficient and will make you think Emacs is frozen.
> How about if \\(.*\\) used to enclose a set of `\|'
> alternatives or for referencing in font-lock expressions?
The \(..\) subgroups are cheap, so I wouldn't worry about them
w.r.t performance. If you really care about their performance impact,
you can use the non-numbered (aka "shy") groups which are written
\(?:...\), but I doubt you'd be able to measure a difference.
Stefan