[PATCH] fix some performance gaps in Xace

Kristian Høgsberg krh at bitplanet.net
Fri Nov 2 09:59:58 PDT 2007

On 11/1/07, Arjan van de Ven <arjan at infradead.org> wrote:
> >From 50d6941ab3af3297212fbcc20231bcaf0c8c6463 Mon Sep 17 00:00:00 2001
> From: root <root at benny.jf.intel.com>
> Date: Tue, 30 Oct 2007 23:43:24 +0100
> Subject: [PATCH] fix some performance gaps in Xace
> The XaceHook function is used in several hotpaths.
> The problem with it (performance wise) is twofold:
>  * The XaceHook function has a big switch() statement for the hook number in it
>  * The XaceHook function uses varargs to reassemble the final dispatch arguments again
> Both are expensive operations... for something that is known at compile time
> This patch turns the hotpath XaceHook call into a direct call to avoid
> the switch and varargs; this gives me over 10% performance gain
> on the x11perf benchmark.
> This is only a conversion of three of the hooks; I would suggest doing all of them this way
> and getting rid of the generic multiplexer entirely... but I'd like input on that from the maintainer
> (who might even be motivated to do that... for me .. with this the performance thing is solved ;)

It looks reasonably to me, but you should consider following the X
server coding convention. Ie call the functions

    XaceHookCoreDispatch(ClientPtr ptr)
    XaceHookAuditBegin(ClientPtr ptr)
    XaceHookAuditEnd(ClientPtr ptr, int i)

and possible even without the 'Hook' in the name. No, I'm not a big
fan of camel caps either.


More information about the xorg mailing list