From 117f4c05614a5c3f5d0495dab553f76a173dbeea Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 28 Mar 2024 14:51:31 +0200 Subject: speed up ScPatternAttr we know that ScPatternAttr uses a single, contiguous range of item ids, so we can compute the item offset at compile time. Shaves 1-2% off some workloads. Change-Id: I623b8cb3e0d5d070118117196d2b48575f505725 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165550 Tested-by: Jenkins Reviewed-by: Noel Grandin --- include/svl/itemset.hxx | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include') diff --git a/include/svl/itemset.hxx b/include/svl/itemset.hxx index 3f1d3b2fd0e2..df0ffdcfd861 100644 --- a/include/svl/itemset.hxx +++ b/include/svl/itemset.hxx @@ -217,6 +217,10 @@ public: sal_uInt16 GetWhichByOffset(sal_uInt16 nOffset) const; + // Optimised variant for those situations where we know exactly what our which ranges are, + // and we can determine the offset at compile time. + const SfxPoolItem& GetByOffset(sal_uInt16 nWhich, sal_uInt16 nOffset) const; + SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent = true, const SfxPoolItem **ppItem = nullptr) const { // use local helper, start value for looped-through SfxItemState value is SfxItemState::UNKNOWN -- cgit