[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Speedup of random indesing of sparse matrices (comparison to scilab)
From: |
David Bateman |
Subject: |
Re: Speedup of random indesing of sparse matrices (comparison to scilab) |
Date: |
Tue, 09 Oct 2007 22:09:34 +0200 |
User-agent: |
Thunderbird 1.5.0.7 (X11/20060921) |
John W. Eaton wrote:
> On 9-Oct-2007, David Bateman wrote:
>
> | Here is another minor speedup in the same patch. Essentially in the
> | Sparse<T>::assign function we access the lhs.data, lhs.ridx, lhs.cidx
> | and lhs.elem methods in numerous places on the RHS of expressions.
> | However, as lhs is not const this means that these methods will call the
> | make_unique function, which results is a significant overhead. Making a
> | const copy of lhs and using that everywhere on the RHS of expressions
> | can avoid the calls to make_unique.
>
> OK.
There are probably other places where the same simple trick can speed
things up.
>
> | For good measure I compared
> |
> | rand ('state', 1); n = 1e5; m = 1e3; a = spalloc(n,n,m*m); i = ceil(n *
> | rand(1,m)); j = ceil(n * rand(1,m)); t0 = cputime(); a(i,j) = rand(m,m);
> | cputime() - t0
> |
> | against Octave 2.9.14, Octave 2.9.14+ with the attached patch and
> | MatlabR2007a and got the results
> |
> | Octave 2.9.14: 0.17897
> | Octave 2.9.14+: 0.17016
> | MatlabR2007a: Did not complete after 10minutes
>
> Ouch.
Yeah, its a nice test if you want to embarrass Matlab....
> OK, please check in this and any other pending patches you have.
> I still have a few things to look at but I'd like to make 2.9.15 in a
> day or two.
I have no fix for the patch issues with multiple patches yet, and I have
an open question on the readline completion, but have or am in the
process of checking in the rest.
D.