[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-hackers] [PATCH] Irregex bugfix and update to 0.9.1
From: |
Peter Bex |
Subject: |
Re: [Chicken-hackers] [PATCH] Irregex bugfix and update to 0.9.1 |
Date: |
Tue, 27 Nov 2012 21:09:19 +0100 |
User-agent: |
Mutt/1.4.2.3i |
On Tue, Nov 27, 2012 at 08:46:22PM +0100, Peter Bex wrote:
> Hi all,
>
> Prompted by some discussion and a bogus patch by me, Alex came up with
> a very simple but effective fix for ticket #686. We've made a new
> bugfix release for irregex, 0.9.1, so here's a patch to bring Chicken
> up-to-date with upstream.
>
> The fix is pretty simple; if you know the regex is a "searcher" (one
> that starts with 'bos, ie the beginning of a string), don't loop in
> the fold procedure because it can't possibly match anymore. This should
> also improve performance for such regex matches that can be short-cut
> like this.
This fix turns out to be incomplete. A regex like (or (seq bos "a") "b")
is not a searcher (because a regex is a searcher only when all its
components are searchers), and will still do the wrong thing when used
with irregex-replace/all.
However, this patch can still be applied as it has been pushed to
upstream and should indeed be a performance improvement in all
cases, I think, and it correctly fixes the simpler cases.
A more complete patch will hopefully be posted later.
Cheers,
Peter
--
http://sjamaan.ath.cx
--
"The process of preparing programs for a digital computer
is especially attractive, not only because it can be economically
and scientifically rewarding, but also because it can be an aesthetic
experience much like composing poetry or music."
-- Donald Knuth