calc: faster sums ...

Kohei Yoshida libreoffice at
Thu Oct 29 11:26:25 PDT 2015

Hi Michael,

> On October 29, 2015 at 10:21 AM Michael Meeks <michael.meeks at>
> wrote:
> Hi Kohei,
> 	I'd love some input (if you have a minute) on the attached. The
> punch-line is, that if we want to do really fast arithmetic, we start to
> need to do some odd things; while I suspect that this piece of unrolling
> can be done with the iterator

So, if I'm not mistaken of your intent, you can just do

const double* p = &sc::numeric_block::at(*, nOffset);

to have direct access to the double array at specified offset, without needing
to do a weird hack like that.

 - the next step I'm poking at (SSE3
> assembler ;-) is not going to like that.

What kind of data access do you need to achieve that, or would the above
approach be sufficient?

> 	The win from this on a sum heavy sheet calculation is from 14.4s
> seconds to recalculate to 9s (actually testing using the
> 'puncture_mdds_encap' approach ;-) - a 35%+ speedup.

This is a good chunk of speedup indeed. :-)

> 	I guess, what I'd most like is a:
> 	'const double *getDoubles(size_t nAtOffset);
> 	Or somesuch =) or, failing that - a chunked double iterator that would
> give a pointer and size (reflecting the underlying chunks but giving
> some freedom there).

So, the above at(*data, offset) method can be used to get a pointer to the
underlying array.  The size of the entire array is already stored with
rNode.size. Additionally, if you ever need to get the logical position of the
head of the array, it is stored with rNode.position.

I *hope* this is all you'll need?  If not, let me know and I'll be happy to give
you a help.


More information about the LibreOffice mailing list