Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 4 Apr 2012 14:33:05 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        phk@freebsd.org
Cc:        arch@freebsd.org
Subject:   EVENTHANDLER()'s
Message-ID:  <201204041433.05652.jhb@freebsd.org>

next in thread | raw e-mail | index | archive | help
So many years ago (2004), you removed support for "fast" EVENTHANDLER() 
objects.  I was looking at this today and I kind of think we should actually 
undo that, but perhaps instead what we should do is make all EVENTHANDLER()'s 
"fast".  No one creates eventhandlers with dynamic names (nor have they ever 
AFAIK), they all have static names.  However, each time someone calls 
EVENTHANDLER_INVOKE() we do an O(n) loop with strcmp's to lookup the list by 
it's name via a string.  It seems to me that we would do just fine with having 
all the eventhandler lists be global variables like the old "fast" variants 
and the string "tag" passed to all the EVENTHANDLER macros would just be used 
to set the variable name (exactly like the old "fast" variants).  This would 
remove all the O(n) lookups, and we could further optimize _INVOKE() to not do 
any locking if the list is empty to avoid overhead in the case where there are 
no active hooks.

-- 
John Baldwin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201204041433.05652.jhb>