[Webkit-unassigned] [Bug 15853] date-format-xparb spends 5% of TOTAL TIME in notify_check

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Nov 7 23:08:30 PST 2007


http://bugs.webkit.org/show_bug.cgi?id=15853





------- Comment #3 from eric at webkit.org  2007-11-07 23:08 PDT -------
Well, regarding the unix signal: you get to pick your own.  Check out the API
in /usr/lib/notify.h

As mjs and I discussed you would sign up for the signal and then have a global
var cache of the timezone and two global var counters.  Assuming ++ is atomic
on all platforms we care about, then you just have your sig handler increment
one of the counters.  Every time we go to access the timezone info, we first
check if the counters match.  If they don't then we assign the other counter to
the signal counter's value, and then go and update the cached timezone info
(using a normal localtime_r call, or whatever.

That should be thread safe.  All your doing is incrementing a global counter in
a sig-handler, so it shouldn't matter what thread it's delivered on.  If
another signal is delivered mid update, at any point during the update, the
worst it should cause is that you end up updating with the same timezone twice.
 Never should you miss a timezone update.

This method should be much faster than notify_check (which for whatever reason
is ridiculously slow.  It uses a shared memory region and probably some locking
of some form).  localtime_r also uses a mutex and notify_check, sadly.


-- 
Configure bugmail: http://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list