xserver: Branch 'master'
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Dec 11 18:42:44 UTC 2018
dix/resource.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
New commits:
commit c73116540205c20162befe935ef608f4bed3af0a
Author: Olivier Fourdan <ofourdan at redhat.com>
Date: Fri Nov 30 13:09:53 2018 +0100
dix: cache ResourceClientBits() value
The `LimitClient` is set once and for all at startup, whereas the
function `ResourceClientBits()` which returns the client field offset
within the XID based on the value of `LimitClient` can be called
repeatedly.
Small optimization, cache the result of `ilog2()`, that saves running
the same loop over and over each time `ResourceClientBits()` is called.
Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
diff --git a/dix/resource.c b/dix/resource.c
index b6ef99f10..a42cd007f 100644
--- a/dix/resource.c
+++ b/dix/resource.c
@@ -620,7 +620,12 @@ ilog2(int val)
unsigned int
ResourceClientBits(void)
{
- return (ilog2(LimitClients));
+ static unsigned int cached = 0;
+
+ if (cached == 0)
+ cached = ilog2(LimitClients);
+
+ return cached;
}
/*****************
More information about the xorg-commit
mailing list