Matthias Brantner has proposed merging lp:~matthias-brantner/zorba/bug-fixing 
into lp:zorba.

Requested reviews:
  Markos Zaharioudakis (markos-za)

For more details, see:
https://code.launchpad.net/~matthias-brantner/zorba/bug-fixing/+merge/79732

Caching the default collator in the static context. This gives approx. 40% 
performance improvements when called from TypedValueCompareIterator::openImpl 
because resolving the URI every time is very expensive.
-- 
https://code.launchpad.net/~matthias-brantner/zorba/bug-fixing/+merge/79732
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/context/static_context.cpp'
--- src/context/static_context.cpp	2011-09-30 08:08:13 +0000
+++ src/context/static_context.cpp	2011-10-18 19:15:29 +0000
@@ -483,6 +483,7 @@
   theDocumentMap(NULL),
   theCollationMap(NULL),
   theDefaultCollation(NULL),
+  theCachedDefaultCollator(NULL),
   theOptionMap(NULL),
   theAuditEvent(&zorba::audit::NOP_EVENT_IMPL),
 #ifndef ZORBA_NO_FULL_TEXT
@@ -530,6 +531,7 @@
   theDocumentMap(NULL),
   theCollationMap(NULL),
   theDefaultCollation(NULL),
+  theCachedDefaultCollator(NULL),
   theOptionMap(NULL),
   theAuditEvent(&zorba::audit::NOP_EVENT_IMPL),
 #ifndef ZORBA_NO_FULL_TEXT
@@ -582,6 +584,7 @@
   theDocumentMap(NULL),
   theCollationMap(NULL),
   theDefaultCollation(NULL),
+  theCachedDefaultCollator(NULL),
   theOptionMap(NULL),
   theAuditEvent(&zorba::audit::NOP_EVENT_IMPL),
 #ifndef ZORBA_NO_FULL_TEXT
@@ -3088,8 +3091,12 @@
 ********************************************************************************/
 XQPCollator* static_context::get_default_collator(const QueryLoc& loc) const
 {
-  const std::string& default_collation = get_default_collation(loc);
-  return get_collator(default_collation, loc);
+  if (!theCachedDefaultCollator)
+  {
+    const std::string& default_collation = get_default_collation(loc);
+    theCachedDefaultCollator = get_collator(default_collation, loc);
+  }
+  return theCachedDefaultCollator;
 }
 
 

=== modified file 'src/context/static_context.h'
--- src/context/static_context.h	2011-09-30 08:08:13 +0000
+++ src/context/static_context.h	2011-10-18 19:15:29 +0000
@@ -553,6 +553,7 @@
 
   CollationMap                          * theCollationMap;
   std::string                           * theDefaultCollation;
+  mutable XQPCollator                   * theCachedDefaultCollator;
 
   OptionMap                             * theOptionMap;
 

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to     : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp

Reply via email to