Difference between revisions of "Performance/WriterLoadSave"

From Apache OpenOffice Wiki
Jump to: navigation, search
m
(profiling)
Line 1: Line 1:
 
{{Performance}}
 
{{Performance}}
<P>Started investigation of load/save issues in Writer using VTune.
+
== Investigation and Profiling of Writer Load/Save Performance ==
The first test document is the ODF
+
I (b_michaelsen) started a systematic profiling of the load/save performance on a current milestone (DEV300_m45). Im using Intel vTune on Windows and cachegrind (with cache-simulation) on Linux. On each platform each of the four documents (see Testdocuments below) is profiled for a load and a save procedure. Each measurement is done twice. In total, this will result in:
1.1 specification document (http://docs.oasis-open.org/office/v1.1/OS/OpenDocument-v1.1.odt)</A>.  
+
2 (platforms/profilers) * 4 (documents) * 2 (load/save) * 2 (measurements) = 32 measurements in total
</P>
+
The analysis of the data should:
 +
* show, if the profiler output is stable and reproducable
 +
* show, if there are any differences between platforms and profiler (and for cachegrind: does cache-simulation result in meaningful additional accuracy?)
 +
* identify the hotspots of the current implementation
 +
* be a basis to evalute the progress by optimizations
 +
 
 +
As of now, profiling is almost done, Im starting with the analysis of the data.
 +
 
 +
== Optimizations ==
 
<UL>
 
<UL>
 
<LI><P>Already done:</P>
 
<LI><P>Already done:</P>
Line 49: Line 57:
 
<P>The result is not as expected. In [[Media:Odfsave_withhash.ods]] you can see that SfxItemPropertyMap::getByName() takes longer than before. The new function takes about 5.3 s totally. These are about 1.7 s more than it's predecessor SfxItemPropertyMap::GetByName() required. The time is consumed mostly in the _M_Find<::rtl::OUString> method of the hash_map implementation. </P>
 
<P>The result is not as expected. In [[Media:Odfsave_withhash.ods]] you can see that SfxItemPropertyMap::getByName() takes longer than before. The new function takes about 5.3 s totally. These are about 1.7 s more than it's predecessor SfxItemPropertyMap::GetByName() required. The time is consumed mostly in the _M_Find<::rtl::OUString> method of the hash_map implementation. </P>
 
<P>One of the probable reasons is the fact that the sorted access to properties eliminated a lot of string comparisons. </P>
 
<P>One of the probable reasons is the fact that the sorted access to properties eliminated a lot of string comparisons. </P>
 +
 +
== Test Documents ==
 +
 +
* http://docs.oasis-open.org/office/v1.1/OS/OpenDocument-v1.1.odt (long specification document)
 +
* http://www.fonaso.com/translations/FonasoVersatil-German-V1.8.doc (short document with images)
 +
* https://eldorado.uni-dortmund.de/bitstream/2003/21520/2/Jackler.doc (~150 pages scientific paper with tables and images)
 +
* MailMerge Document (~600 pages, to be uploaded)
 +
Microsoft Word Documents where loaded and saved as odt before profiling.
  
 
[[Category:Performance]]
 
[[Category:Performance]]

Revision as of 11:48, 27 March 2009

Performance 170.png
Performance Project

performance.openoffice.org

Quick Navigation

Team

Communication

Activities

About this template


Investigation and Profiling of Writer Load/Save Performance

I (b_michaelsen) started a systematic profiling of the load/save performance on a current milestone (DEV300_m45). Im using Intel vTune on Windows and cachegrind (with cache-simulation) on Linux. On each platform each of the four documents (see Testdocuments below) is profiled for a load and a save procedure. Each measurement is done twice. In total, this will result in:

2 (platforms/profilers) * 4 (documents) * 2 (load/save) * 2 (measurements) = 32 measurements in total

The analysis of the data should:

  • show, if the profiler output is stable and reproducable
  • show, if there are any differences between platforms and profiler (and for cachegrind: does cache-simulation result in meaningful additional accuracy?)
  • identify the hotspots of the current implementation
  • be a basis to evalute the progress by optimizations

As of now, profiling is almost done, Im starting with the analysis of the data.

Optimizations

  • Already done:

  • Already identified issues:

    • To decide which properties have to be saved xmloff uses the interface methods css::beans::XPropertyState::getPropertyStates() and css::beans::XMultiPropertySet::getPropertyValues(). It could also use the interface css::beans::XTolerantMultiPropertySet::getDirectPropertyValuesTolerant() which is not implemented for Writer's UNO objects.

    • Saving Writer's text content is done by iterating over the paragraphs and iterating over so-called text portions within the paragraphs. Text portions are parts of the paragraph that have a single attribute set, text fields, redline portions, inline anchored frames etc. It might make sense to detect their properties at construction time and preset their css::uno::XTolerantMultiPropertySet interface.
      And the moment a text portion is created that adds a bookmark to remember it's position. The impact on real documents is not yet checked.

A test implementation of the XTolerantMultiPropertySet in Writer's text portion objects didn't result in increased save speed.

In the spreadsheet Media:odfsave.ods you can find a list of the top consumers from some selected libraries (sw, xo, svl, svt, sal3, sfx2) when saving the ODF specification document. I will concentrate on two issues here:

  • Conversion of hyperlinks takes a lot of time. To bring hyperlinks into the correct form and to make them relative to the target URL the methods from svt's URIHelper are used. This is done for _all_ URLs independent of the protocol. In the given document URLs are mostly http while the document is stored to file. One approach to solve this issue is to convert only if the protocols are the same. Another approach is to manage the hyperlinks within the document and to keep them in the correct form all the time. So they only have to be converted at the time the target URL changes (saveAs/storeToURL). On the given system this would save about 4 s from a total of 12 s save time. (stopwatch estimation)

  • Another rather big part of processing time is consumed to access the members of the implementations of css::beans::XPropertySet, XPropertyState, XPropertySetInfo. To find the requested element by it's name the methods from SfxItemPropertySet, SfxItemPropertySetInfo etc. iterate over an array of structs that define a property (SfxItemPropertyMap). This can be seen by the numbers from SfxItemPropertyMap::getByName, rtl::OUString::equalsAsciiL, SfxItemPropertySetInfo::hasPropertyByName in the svl library.

The replacement for the SfxItemPropertyMap that uses an std::hash_map is ready. After changing a lot of code in the applications as well as in svtools, sfx2, svx and others I started to compare the load/save times.

The result is not as expected. In Media:Odfsave_withhash.ods you can see that SfxItemPropertyMap::getByName() takes longer than before. The new function takes about 5.3 s totally. These are about 1.7 s more than it's predecessor SfxItemPropertyMap::GetByName() required. The time is consumed mostly in the _M_Find<::rtl::OUString> method of the hash_map implementation.

One of the probable reasons is the fact that the sorted access to properties eliminated a lot of string comparisons.

Test Documents

Microsoft Word Documents where loaded and saved as odt before profiling.

Personal tools