Issue 120824

Summary: Load/Save performance: Improve StyleSheet mapping, reduce broadcasting on load
Product: Calc Reporter: Armin Le Grand <Armin.Le.Grand>
Component: save-exportAssignee: AOO issues mailing list <issues>
Status: CLOSED FIXED QA Contact:
Severity: Normal    
Priority: P3    
Version: 4.0.0-dev   
Target Milestone: 4.0.0   
Hardware: All   
OS: All   
Issue Type: DEFECT Latest Confirmation in: ---
Developer Difficulty: ---

Description Armin Le Grand 2012-09-05 14:34:26 UTC
ALG: Currently the calc xls export iterates over the existing styles every time; this can be optimized.
Comment 1 Armin Le Grand 2012-09-05 14:42:12 UTC
ALG: In XclExpXFBuffer the styles for export are held in a XclExpXFList (called maXFList). The method FindXF is used to checl if a style already exists. To do so, it iterates liinear over all existing styles. This is done often during export.
To speed this up it would be better to hash this with the ItemSet as key and an index in the list as value. This can be on demand (extending as the list extends). Checking if/how this can be encapsulated.
Comment 2 Armin Le Grand 2012-09-05 14:48:36 UTC
ALG: Extended all constructors of XclExpXF, member initialisations were missing.
Added maXclExpXFMap as std::multimap for < const SfxItemSet*, XclExpXF* > to class XclExpXFBuffer (where maXFList resides, too).
Adapted both FindXF to use the multimap for faster access. Both will on demand extend the multimap to newly added list entries.

Works as expected, tested with *.xls files in the new trunk/test path. Load *.xls, save as *.xls (somewhere else), reload. The 272k example sc_complex_13sh_4kcell.xls went from 12 to 8 seconds savetime (average).
Comment 3 Armin Le Grand 2012-09-05 14:58:10 UTC
ALG: Another bottleneck is ScStyleObj::SetOnePropertyValue because for every single property change a StyleSheetChange update is triggered. Since this update is independent from the property it can be optimized to do that after a range of properties is set.
Added ScStyleObj::SetOnePropertyValueWithoutUpdate, made ScStyleObj::SetOnePropertyValue use it and call StyleSheetChangedUpdate() (also added and extracted from ScStyleObj::SetOnePropertyValue. Using in ScStyleObj::setPropertyValues to set all props in a loop and call update only once.
Comment 4 Armin Le Grand 2012-09-05 15:45:53 UTC
ALG: Checked the code again and secured the XclExpXFList::ReplaceRecord calls; these need to reset the multimap buffer since the key value might change.
Comment 5 Armin Le Grand 2012-09-05 16:06:25 UTC
ALG: Doing some more tests...
Comment 6 Armin Le Grand 2012-09-06 10:17:06 UTC
ALG: Checked stuff from comment3 (load any *.ods from trunk/test). Works as expected. Changing title, it's enhancements for import (comment 1,2) and export (comment 3).
Comment 7 SVN Robot 2012-09-06 10:18:10 UTC
"alg" committed SVN revision 1381548 into trunk:
#120824# improve load/sve performance for spreadsheet
Comment 8 Armin Le Grand 2012-09-06 10:18:52 UTC
ALG: Okay, comitted, done
Comment 9 Armin Le Grand 2012-09-12 09:57:28 UTC
ALG: Okay, done.