EVENTHANDLER()'s
John Baldwin
jhb at freebsd.org
Wed Apr 4 19:36:16 UTC 2012
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
More information about the freebsd-arch
mailing list