Re: Performance implications of GRegex structure



On Fri, 2007-03-16 at 21:15 -0500, Yevgen Muntyan wrote:
> Matthias Clasen wrote:
> > On 3/16/07, Marco Barisione <marco barisione org> wrote:
> >
> >   
> >> BTW if you want I can split GRegex in two separate objects.
> >>     
> >
> > Since that seems to be the overwhelming preference,
> "overwhelming"?
> >  that might
> > be a good idea. I hope this shouldn't be too bad, since GRegex
> > is already split into pattern and match objects, internally.
> >   
> Exactly, internally. Compare
> 
> return g_regex_match(re, "foobar", 0, 0);
> 
> and
> 
> Match *m;
> gboolean result;
> m = g_regex_match(re, "foobar", 0, 0);
> result = m != NULL;
> g_regex_match_free(m);
> return result;

This is certainly a common case, and it's important to optimize
for it. But I'd rather see it optimized with a convenience function
than by forcing an (in my opinion) unnatural structure on GRegex.

As said in my reply to Marco, it's certainly very possible to 
have:

  return g_regex_matches(re, "foobar", -1, 0);

Without storing state in the regular expression.

					- Owen






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