From 47a5f678f5eefffd456d3454364d806ba29e8920 Mon Sep 17 00:00:00 2001
From: mread <qt-info@nokia.com>
Date: Mon, 27 Sep 2010 16:53:49 +0100
Subject: hybrid allocator tuning

Set various pragmas and defines to tune the hybrid allocator.

Performance test was the time takes to allocate or deallocate as
appropriate 1,000,000 times from a set of 100,000 pointers, selected at
random, with sizes generated randomly with min 2, max 5960, avg 46.
The function was exp(8 - log(2 + rand(0..1023))) * rand(1 or 4).

The following parameters were chosen:
   * pragma arm, for ~1.2%
   * pragma Otime, for ~3%
   * pragma O2, already the compiler default, just to be sure
   * all possible slab sizes enabled, for ~1%

NB Disabling BTrace would also gain ~1.5%, but that seems like a bad
thing to do. Not done.

Task-number: QT-3967
Reviewed-by: Shane Kearns
---
 src/corelib/arch/symbian/heap_hybrid.cpp           | 3 ++-
 src/corelib/arch/symbian/qt_hybridHeap_symbian_p.h | 7 +++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/corelib/arch/symbian/heap_hybrid.cpp b/src/corelib/arch/symbian/heap_hybrid.cpp
index 4d101ed..f650b5b 100644
--- a/src/corelib/arch/symbian/heap_hybrid.cpp
+++ b/src/corelib/arch/symbian/heap_hybrid.cpp
@@ -45,7 +45,8 @@
 
 // if non zero this causes the iSlabs to be configured only when the chunk size exceeds this level
 #define DELAYED_SLAB_THRESHOLD (64*1024)		// 64KB seems about right based on trace data
-#define SLAB_CONFIG 0xabe						// Use slabs of size 48, 40, 32, 24, 20, 16, 12, and 8 bytes
+//#define SLAB_CONFIG 0xabe						// Use slabs of size 48, 40, 32, 24, 20, 16, 12, and 8 bytes
+#define SLAB_CONFIG 0x3fff						// Use all slab sizes 4,8..56 bytes
 
 #ifdef _DEBUG
 #define __SIMULATE_ALLOC_FAIL(s)	if (CheckForSimulatedAllocFail()) {s}
diff --git a/src/corelib/arch/symbian/qt_hybridHeap_symbian_p.h b/src/corelib/arch/symbian/qt_hybridHeap_symbian_p.h
index eb43bf8..55c8fb2 100644
--- a/src/corelib/arch/symbian/qt_hybridHeap_symbian_p.h
+++ b/src/corelib/arch/symbian/qt_hybridHeap_symbian_p.h
@@ -52,6 +52,13 @@
 
 #ifdef QT_USE_NEW_SYMBIAN_ALLOCATOR
 
+#ifndef __WINS__
+#pragma push
+#pragma arm
+#pragma Otime
+#pragma O2
+#endif
+
 #include "common_p.h"
 #ifdef QT_SYMBIAN_HAVE_U32STD_H
 #include <u32std.h>
-- 
cgit v0.12