octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Speedup of random indesing of sparse matrices (comparison to scilab)


From: John W. Eaton
Subject: Re: Speedup of random indesing of sparse matrices (comparison to scilab)
Date: Tue, 09 Oct 2007 13:46:56 -0400

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.

| 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.

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.

Thanks,

jwe


reply via email to

[Prev in Thread] Current Thread [Next in Thread]