Boost logo

Boost Users :

From: John Maddock (john_at_[hidden])
Date: 2006-04-12 05:16:42


> Would it be feasible/advantageous for the regex-related libraries to
> automagically to "cache" the immediately previous regex compilation?
> (or provide as an option)

Feasable, yes, in the sense that anything is feasable, probably not
advantageous though, it depends entirely on how it's used.

> I've seen code that had the same regex being compiled inside a loop,
> which I suppose would really diminish performance. Perhaps this could
> be detected, and the user/developer "protected from themselves" ...
> and/or perhaps informed that this is happening?

Nod, that's a very bad idea, but I don't see how we can protect against it.

> Could there be a "helper" class that somehow or other allowed the last
> "n" regexes to be cached? (btw .... what is the plural of regex ....
> regexen? regices?)

You mean a generic cache object? It's been asked for before, and should be
an entirely separate facility from regex/xpressive/spirit. Boost.Regex does
actually use one internally to cache some locale-related structures (which
rairly if ever change in typical useage). See
boost/regex/pending/object_cache.hpp if you want the dirty details, or want
to borrow the code.

John.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net