octave-maintainers
[Top][All Lists]
Advanced

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

Re: performance problem with unique on sparse arrays


From: David Bateman
Subject: Re: performance problem with unique on sparse arrays
Date: Sat, 20 Mar 2010 23:42:36 +0100
User-agent: Mozilla-Thunderbird 2.0.0.22 (X11/20090706)

Jaroslav Hajek wrote:

Hi David,

I started modernizing the Sparse indexing interface. In particular the
interfaces are updated so that idx_vector is passed by a const
reference and bool flags are used rather than int. I removed the
obsolete calls like idx_vector::freeze and improved the code using new
features from octave_sort and idx_vector, and in the end I ended with
a rewrite, along with some induced changes.


<snip>
so it doesn't seem I slowed something down significantly except
perhaps the sparse row vector.
In that case, the scalar and cont. range is specialized, otherwise the
array is converted to full, indexed, and then sparsified.
I thought this was OK because a sparse row vector takes O(nc) space
anyway, so it's an inefficient way to store a sparse vector. Sparse
column vector is the way to go here.

You're welcome to review the changes and comment on them.
I took a look at this code and it seems find to me. I suspect the row vector code was probably already pretty good so you could get much of an improvement and the cases where you are slower are just in the noise. It seems my previous patch didn't last long ;-)

I'll address the 2D indexing next, then eventually indexed assignment.
That's going to be a bit harder, and the assign stuff even harder again.. But hey one step at a time..

Cheers
David



regards



--
David Bateman                                address@hidden
35 rue Gambetta                              +33 1 46 04 02 18 (Home)
92100 Boulogne-Billancourt FRANCE            +33 6 72 01 06 33 (Mob)



reply via email to

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