From e439058541cd02937cf43f399fef8767bd3d4996 Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Wed, 28 Sep 2016 13:16:11 +0200 Subject: sc-perf: avoid second call to ScAttrArray::Search(), tdf#87101 related In that scenario, of 36791233 calls only 9217 were necessary as most times nRow2 equals nRow1. Change-Id: I14228d065175addee76b9142c98110efe59701e7 --- sc/source/core/data/attarray.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'sc') diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx index 0f51713fae9f..fb90fb435cb4 100644 --- a/sc/source/core/data/attarray.cxx +++ b/sc/source/core/data/attarray.cxx @@ -1199,7 +1199,10 @@ bool ScAttrArray::HasAttrib( SCROW nRow1, SCROW nRow2, HasAttrFlags nMask ) cons SCSIZE nStartIndex; SCSIZE nEndIndex; Search( nRow1, nStartIndex ); - Search( nRow2, nEndIndex ); + if (nRow1 != nRow2) + Search( nRow2, nEndIndex ); + else + nEndIndex = nStartIndex; bool bFound = false; for (SCSIZE i=nStartIndex; i<=nEndIndex && !bFound; i++) -- cgit