emacs-pretest-bug
[Top][All Lists]
Advanced

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

Re: Regular expression too big


From: Greg Detre
Subject: Re: Regular expression too big
Date: Mon, 26 Mar 2007 16:08:10 -0400
User-agent: Thunderbird 1.5.0.10 (X11/20070304)

thanks, stefan. that makes sense. but it would need to run within the fontification function, so we'd like it to be speedy...

g


Stefan Monnier wrote:
Thank you for your response.  It was helpful to know that this isn't going
to be an easy fix.  We're already using regexp-opt, which is supposed to
optimize and shrink the regex.

In that case I don't think there's much you can do (you may be able to
tweak regexp-opt to reduce the compiled regexp size, but you'll just get
a few percent further, which probably isn't of any use to you).

I can anticipate the regexes getting much much bigger, and I'm keen to
avoid having to dig into the guts of the regexp C code, so I think we're
going to figure out a way to do our regexing outside of Emacs.

Looks like your best/only option.  Of course you may also be able to do it
all in Emacs by not using regexps.  E.g. if your code looks anything like

   (re-search-forward (concat "foo" (regexp-opt mighty-big-list) "bar"))

you may be able to use

   (while (and (re-search-forward (concat "foo\(.*\)bar"))
               (not (member (match-string 1) mighty-big-list))))

And of course, use a hash-table rather than a list.


        Stefan


--


---
Greg Detre
cell: 617 642 3902
email: address@hidden
web: http://www.gregdetre.co.uk





reply via email to

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