xserver: Branch 'master'
Michel Daenzer
daenzer at kemper.freedesktop.org
Thu Apr 17 07:11:15 PDT 2008
include/privates.h | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
New commits:
commit 9b30cc524867a0ad3d0d2227e167f4284830ab4e
Author: Michel Dänzer <michel at tungstengraphics.com>
Date: Thu Apr 17 16:10:10 2008 +0200
Optimize dixLookupPrivate for repeated lookups of the same private.
This gives me a 20% speedup for EXA text rendering, though I still seem to burn
quite a lot of cycles in here...
diff --git a/include/privates.h b/include/privates.h
index 8d59b72..093d177 100644
--- a/include/privates.h
+++ b/include/privates.h
@@ -46,13 +46,20 @@ dixAllocatePrivate(PrivateRec **privates, const DevPrivateKey key);
static _X_INLINE pointer
dixLookupPrivate(PrivateRec **privates, const DevPrivateKey key)
{
- PrivateRec *rec = *privates;
+ PrivateRec *rec, *prev;
pointer *ptr;
- while (rec) {
- if (rec->key == key)
- return rec->value;
- rec = rec->next;
+ for (rec = *privates, prev = NULL; rec; prev = rec, rec = rec->next) {
+ if (rec->key != key)
+ continue;
+
+ if (prev) {
+ prev->next = rec->next;
+ rec->next = *privates;
+ *privates = rec;
+ }
+
+ return rec->value;
}
ptr = dixAllocatePrivate(privates, key);
More information about the xorg-commit
mailing list