Re: Some performance notes



Hi,

> > > > in gobject.c is always a function call, but if you trace
> > > > down the G_LOCK() macro used elsewhere, you'll see it doesn't
> > > > make a function call unless threading is enabled.
> > >
> > > do you have any indication of g_static_rw_lock_reader_lock()
> > > actually consuming significant time for the non-threaded case?
> >
> > Yes, in my profiling (debug off) it was eating about 4% of the
> > CPU time.
> 
> wow, that requires further investigation, as i vaguely remember a
> profile of sebastian that indicated locks being pretty fast for
> the non-threaded case.

It should be, it just involves calling

  if (!g_threads_got_initialized)
    return;

But of course the penalty of first doing the function call still applies.
So we might make them macros and call them only, when the thread system is
really initialize, as with the other virtual thread related functions:

Like this:

#define g_static_rw_lock_writer_lock(lock) (g_thread_supported () ? \
          g_static_rw_lock_writer_lock_internal (lock) : (void)0)
void g_static_rw_lock_writer_lock_internal (GStaticRWLock* lock)

What do you think?

Bye,
Sebastian
-- 
Sebastian Wilhelmi
mailto:wilhelmi ira uka de
http://goethe.ira.uka.de/~wilhelmi




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