summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2010-12-13 16:22:33 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2011-04-13 14:38:18 (GMT)
commit8f08be2bd372c581d578ed81c2f57cf1adc0ae79 (patch)
tree3206c7902135884886072462ef01d4e52b576335 /src/corelib
parent162ee8d83c72990c33952a99bd959f18842dde10 (diff)
downloadQt-8f08be2bd372c581d578ed81c2f57cf1adc0ae79.zip
Qt-8f08be2bd372c581d578ed81c2f57cf1adc0ae79.tar.gz
Qt-8f08be2bd372c581d578ed81c2f57cf1adc0ae79.tar.bz2
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
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/kernel/qabstracteventdispatcher.cpp12
1 files 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<int> timerIds[NumberOfBuckets] =
{ Q_BASIC_ATOMIC_INITIALIZER(FirstBucket),
Q_BASIC_ATOMIC_INITIALIZER(0),