On 2010-06-15 09:06, Bartosz wrote:
By the way.
After replace svArrays by STL containers, in some cases I observed boost of 
performance.

For example:
      for (USHORT i = 0;  i<  aEntries.size();  ++i)
      {

         if (aEntries.at(i).aFntFmt == rFntFmt)
         {
             aRes = aEntries[i].aId;
             break;
         }
      }

is much faster than:

     USHORT nCnt = aEntries.Count();
     USHORT i;
     for (i = 0;  i<  nCnt&&   0 == aRes.Len();  ++i)
     {
         if (aEntries[i].aFntFmt == rFntFmt)
              aRes = aEntries[i].aId;
     }

If you're about to optimize then try the iterator-version of above as well. Something like (not tested, off the top of my head, and I don't know the actual type of aEntries):

     EntryType::iterator end = aEntries.end();
     for (EntryType::iterator i = aEntries.begin(); i != end; i++)
     {

        if (i->aFntFmt == rFntFmt)
        {
            aRes = i->aId;
            break;
        }
     }

In some of the code that I work on (not OOo, but another C++ project) I have seen a very nice performance boost by switching from array-style subscripting to iterators.

Cheers
-- Jan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@openoffice.org
For additional commands, e-mail: dev-h...@openoffice.org

Reply via email to