mdds::multi_type_vector (was: Re: C++11 in LibreOffice)

Kohei Yoshida kohei.yoshida at gmail.com
Mon Jul 23 07:54:34 PDT 2012


On 07/23/2012 05:04 AM, Lubos Lunak wrote:

>   Where's the benchmark for that? I'd like to see what difference it makes, but
> I cannot find anything in the blog post.

Good question.  I didn't put benchmark data in because I wanted to first 
get the background story out first, which I knew was going to be 
somewhat long.  I'll do another blog post just for benchmarks, and for 
other performance considerations.

Having said that, I have _some_ numbers to share.  While I can't really 
test the real spreadsheet storage benchmark since doing that would 
require we actually put this structure into ScColumn for real), we can 
simulate it by using the former matrix backend container 
mixed_type_matrix, and compare it to multi_type_matrix which uses 
multi_type_vector as its backend storage.  mixed_type_matrix also had 
its elements allocated on the heap and their memory locations stored in 
its primary array, so it had the same weakness as the current cell 
storage model in ScColumn.

Here are the numbers.  The test scenario is to 1) create a 100,000 by 
1,000 matrix instance and fill it with numeric values, and 2) iterate 
through all its elements and calculate their total.  The results are:

mixed_type_matrix:
1) 0.887776 sec
2) 1.96097 sec

multi_type_matrix:
1) 0.819243 sec
2) 0.364899 sec

The instantiation and insertion performance is only slightly faster, but 
element iteration performance is noticeably faster with multi_type_matrix.

The test code was compiled with g++ with only -Os flag.  I haven't 
tested it with any other optimization flags that gcc provides.

Best,

Kohei

-- 
Kohei Yoshida, LibreOffice hacker, Calc




More information about the LibreOffice mailing list