[PATCH 3/4] dix: Tune dixLookupDrawable for success

Adam Jackson ajax at redhat.com
Tue Dec 13 14:31:52 PST 2011


The vast vast vast majority of resource lookups are successful.  Move some
work to the error paths so we don't punish success.

Before:
40000000 trep @   0.0009 msec (1109091.3/sec): PutImage 10x10 square
60000000 trep @   0.0005 msec (2072652.2/sec): ShmPutImage 10x10 square

After:
40000000 trep @   0.0009 msec (1148346.9/sec): PutImage 10x10 square
60000000 trep @   0.0005 msec (2091666.1/sec): ShmPutImage 10x10 square

Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 dix/dixutils.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/dix/dixutils.c b/dix/dixutils.c
index 1e31346..cfb0397 100644
--- a/dix/dixutils.c
+++ b/dix/dixutils.c
@@ -202,13 +202,12 @@ dixLookupDrawable(DrawablePtr *pDraw, XID id, ClientPtr client,
     int rc;
 
     *pDraw = NULL;
-    client->errorValue = id;
-
-    if (id == INVALID)
-	return BadDrawable;
 
     rc = dixLookupResourceByClass((pointer *)&pTmp, id, RC_DRAWABLE, client, access);
 
+    if (rc != Success)
+	client->errorValue = id;
+
     if (rc == BadValue)
 	return BadDrawable;
     if (rc != Success)
-- 
1.7.7



More information about the xorg-devel mailing list