Re: Performance implications of GRegex structure
- From: Behdad Esfahbod <behdad behdad org>
- To: Morten Welinder <mortenw gnome org>
- Cc: Owen Taylor <otaylor redhat com>, GTK+ development mailing list <gtk-devel-list gnome org>
- Subject: Re: Performance implications of GRegex structure
- Date: Fri, 16 Mar 2007 11:32:05 -0400
On Fri, 2007-03-16 at 09:36 -0400, Morten Welinder wrote:
> Is there a guarantee that for GRegex (unlike, say, GDate) multiple
> threads can use
> the same object at the same time?
>
> I.e., two threads cannot call g_date_get_weekday on the same date, so why are we
> expect that two threads can call g_regex_copy or anything like it?
There are the following reasons to have separate regex and match
objects:
1) Less prune to reentrancy problems
2) Less prune to writing inefficient code
3) More familiar to people who have used any scripting language
4) The GRegex object already has separate match and regex objects
internally, and has to copy them differently to get good performance
possible. This is at best a hack.
So, what's the deal? The question is not "can we please change it?".
It's "why is it this way?".
And as someone already showed, safe simple wrappers can be written
around the regex object for simple boolean queries.
> Morten
--
behdad
http://behdad.org/
"Those who would give up Essential Liberty to purchase a little
Temporary Safety, deserve neither Liberty nor Safety."
-- Benjamin Franklin, 1759
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]