summaryrefslogtreecommitdiff
path: root/sc/inc
diff options
context:
space:
mode:
authorDennis Francis <dennis.francis@collabora.com>2019-10-15 08:32:22 +0530
committerDennis Francis <dennis.francis@collabora.com>2019-10-17 08:09:30 +0200
commitc2d8341ee392949274b901abfd44d9645d2e4e36 (patch)
treeb349f0c02b5521359796a9bd6b118a2dbc6d1ee3 /sc/inc
parent3c2587a152476cbb0ca4a83138a4c34ec8065b32 (diff)
Cache last used number-format-type in interpreter-context
if in cpu-threaded mode so that we can avoid the unnecessary locked SvNumberFormatter::GetType() calls (Mapping between NF index and NF-type does not change while formula-group-threading is running). Change-Id: I648bc08c885da845f0b09cd57013cc1c23e01a61 Reviewed-on: https://gerrit.libreoffice.org/80848 Tested-by: Jenkins Reviewed-by: Dennis Francis <dennis.francis@collabora.com>
Diffstat (limited to 'sc/inc')
-rw-r--r--sc/inc/interpretercontext.hxx11
1 files changed, 11 insertions, 0 deletions
diff --git a/sc/inc/interpretercontext.hxx b/sc/inc/interpretercontext.hxx
index b46a23f4e6a0..4ed6b3c66c4a 100644
--- a/sc/inc/interpretercontext.hxx
+++ b/sc/inc/interpretercontext.hxx
@@ -25,6 +25,7 @@ class ScDocument;
class SvNumberFormatter;
struct ScLookupCacheMap;
class ScInterpreter;
+enum class SvNumFormatType : sal_Int16;
// SetNumberFormat() is not thread-safe, so calls to it need to be delayed to the main thread.
struct DelayedSetNumberFormat
@@ -34,6 +35,13 @@ struct DelayedSetNumberFormat
sal_uInt32 mnNumberFormat;
};
+struct NFIndexAndFmtType
+{
+ sal_uInt32 nIndex;
+ SvNumFormatType eType : 16;
+ bool bIsValid : 1;
+};
+
class ScInterpreterContextPool;
struct ScInterpreterContext
@@ -69,6 +77,8 @@ struct ScInterpreterContext
return mpFormatter;
}
+ SvNumFormatType GetNumberFormatType(sal_uInt32 nFIndex) const;
+
private:
friend class ScInterpreterContextPool;
void ResetTokens();
@@ -77,6 +87,7 @@ private:
void ClearLookupCache();
void initFormatTable();
SvNumberFormatter* mpFormatter;
+ mutable NFIndexAndFmtType maNFTypeCache;
};
class ScThreadedInterpreterContextGetterGuard;