diff options
author | Eike Rathke <erack@redhat.com> | 2017-06-06 20:53:00 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2017-06-06 20:53:47 +0200 |
commit | f300a627b9a88eb8814cc35844ed7c6aa7f19379 (patch) | |
tree | 34d067c5a937d5aced3eb7810aab4571ed225b6b /include/svl | |
parent | c2b256084b086b63a13d16f65d1be2966f4febb3 (diff) |
Perf-sc: tdf#100709 SfxPoolItem::IsVoidItem() instead of dynamic_cast
SfxItemSet::GetItemState()
before, Ir: 4 048 231 416
after, Ir: 2 577 117 709
Change-Id: I26d8b91ad5d851011a670b38b7b98e5582c319cf
Diffstat (limited to 'include/svl')
-rw-r--r-- | include/svl/poolitem.hxx | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/svl/poolitem.hxx b/include/svl/poolitem.hxx index eae64a52388c..2eefbf1f66cf 100644 --- a/include/svl/poolitem.hxx +++ b/include/svl/poolitem.hxx @@ -177,6 +177,13 @@ public: SfxItemKind GetKind() const { return m_nKind; } virtual void dumpAsXml(struct _xmlTextWriter* pWriter) const; + /** Only SfxVoidItem shall and must return true for this. + + This avoids costly calls to dynamic_cast<const SfxVoidItem*>() + specifically in SfxItemSet::GetItemState() + */ + virtual bool IsVoidItem() const; + private: SfxPoolItem& operator=( const SfxPoolItem& ) = delete; }; @@ -253,6 +260,9 @@ public: // create a copy of itself virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; + + /** Always returns true as this is an SfxVoidItem. */ + virtual bool IsVoidItem() const override; }; class SVL_DLLPUBLIC SfxSetItem: public SfxPoolItem |