[PATCH] xace: micro-optimize callbacks

Adam Jackson ajax at redhat.com
Mon Oct 11 08:16:54 PDT 2010


Before this we're calling CallCallbacks three times for every request,
which is a bit expensive.  Check if the callback is non-null first to
avoid the function call overhead.  Improves x11perf -noop from 18.6M/sec
to 23M/sec on a 2.4GHz Core 2 Duo.

Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 Xext/xace.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/Xext/xace.c b/Xext/xace.c
index c757cad..18c9773 100644
--- a/Xext/xace.c
+++ b/Xext/xace.c
@@ -36,6 +36,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 _X_EXPORT CallbackListPtr XaceHooks[XACE_NUM_HOOKS] = {0};
 
+#define CallCallbacks(x, y) \
+    if ((*(x))) CallCallbacks(x, y);
+
 /* Special-cased hook functions.  Called by Xserver.
  */
 int XaceHookDispatch(ClientPtr client, int major)
-- 
1.7.3.1



More information about the xorg-devel mailing list