From 8f08be2bd372c581d578ed81c2f57cf1adc0ae79 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 13 Dec 2010 17:22:33 +0100 Subject: Change the number of entries in the first timer bucket. 8 timers are too few for common applications. 32 is more likely to reach >90% of the applications. This way, we avoid a memory allocation. Reviewed-by: Olivier Goffart --- src/corelib/kernel/qabstracteventdispatcher.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/corelib/kernel/qabstracteventdispatcher.cpp b/src/corelib/kernel/qabstracteventdispatcher.cpp index 07f04b2..b1b1380 100644 --- a/src/corelib/kernel/qabstracteventdispatcher.cpp +++ b/src/corelib/kernel/qabstracteventdispatcher.cpp @@ -49,14 +49,18 @@ QT_BEGIN_NAMESPACE // we allow for 2^24 = 8^8 = 16777216 simultaneously running timers -enum { NumberOfBuckets = 8, FirstBucketSize = 8 }; +enum { NumberOfBuckets = 8, FirstBucketSize = 32 }; static const int BucketSize[NumberOfBuckets] = - { 8, 64, 512, 4096, 32768, 262144, 2097152, 16777216 - 2396744 }; + { 32, 64, 512, 4096, 32768, 262144, 2097152, 16777216 - 2364000 }; static const int BucketOffset[NumberOfBuckets] = - { 0, 8, 72, 584, 4680, 37448, 299592, 2396744 }; + { 0, 32, 96, 608, 4704, 37448, 266848, 2364000 }; + +static int FirstBucket[] = { + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32 +}; -static int FirstBucket[FirstBucketSize] = { 1, 2, 3, 4, 5, 6, 7, 8 }; static QBasicAtomicPointer timerIds[NumberOfBuckets] = { Q_BASIC_ATOMIC_INITIALIZER(FirstBucket), Q_BASIC_ATOMIC_INITIALIZER(0), -- cgit v0.12