Issue 120575 - [From Symphony] optimize a comparing operation from 'memcmp' to 'hash compare' to improve xls loading performance
[From Symphony] optimize a comparing operation from 'memcmp' to 'hash compare...
Status: RESOLVED FIXED
Product: performance
Classification: Code
Component: code
AOO 3.4.0
All All
: P3 normal (vote)
: AOO 4.0
Assigned To: AOO issues mailing list
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-08-15 02:53 UTC by lizh.fee
Modified: 2013-02-16 09:24 UTC (History)
2 users (show)

See Also:
Issue Type: ENHANCEMENT
Latest Confirmation on: ---
Developer Difficulty: ---


Attachments
patch for improving xls loading performance (9.83 KB, patch)
2012-08-24 05:36 UTC, lizh.fee
lizh.fee: review?
Details | Diff
sample (108.00 KB, application/vnd.ms-excel)
2012-08-24 06:00 UTC, lizh.fee
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description lizh.fee 2012-08-15 02:53:52 UTC

    
Comment 1 lizh.fee 2012-08-24 05:36:09 UTC
Created attachment 79115 [details]
patch for improving xls loading performance
Comment 2 lizh.fee 2012-08-24 05:59:33 UTC
Root cause: 
in xls loading procedure, ScPatternAttr::operator== occupies too much time, in this function, two sfxitemset are compared by memcmp(...), this is a time consuming operation.

Resolution:
Instead of memcmp(...), two sfxitemset can be compared 'quickly' by the hashkey only. And a function SfxItemSet::QuickCompare( SfxItemSet & rCmp) instead of EqualPatternSets(...).

Test result:
In ScPatternAttr::operator==, SfxItemSet::QuickCompare( SfxItemSet & rCmp) will be called 3141717 times, including 3114837 times only comparing hash key and directly return, memcmp(...). will be called 26880 times.
Comment 3 lizh.fee 2012-08-24 06:00:28 UTC
Created attachment 79117 [details]
sample
Comment 4 lizh.fee 2012-08-24 06:43:58 UTC
following is test result for sample file (manual test), about 10% improvement. 
old:  4.31 4.38 4.37 4.44 4.31 4.34 4.41 4.40 4.47 4.50     avg:4.40 
new:  3.90 3.93 3.78 3.75 3.75 3.85 3.84 3.87 4.00 4.00     avg:3.87
Comment 5 SVN Robot 2012-09-14 08:04:15 UTC
"leiw" committed SVN revision 1384677 into trunk:
#i120575 optimize a comparing operation from 'memcmp' to 'hash compare' to im...
Comment 6 Wang Lei 2012-09-14 08:07:54 UTC
Submit in revision 1384677, thanks for your patch