Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sparse() is really slow #268

Closed
ViralBShah opened this issue Nov 29, 2011 · 3 comments
Closed

sparse() is really slow #268

ViralBShah opened this issue Nov 29, 2011 · 3 comments
Assignees
Labels
performance Must go faster

Comments

@ViralBShah
Copy link
Member

On the most simple case, julia sparse() is 20 times slower than matlab. I think the code can be written in a better way for sure, but I'm not sure if it will give us 20x improvement. This does not even include the cases where the inputs have to be sorted.

Matlab:

a = 1:100000;
tic; s = sparse(a,a,a); toc
Elapsed time is 0.010585 seconds.

Julia:

julia> x = 1:100000;
julia> tic(); sparse(x,x,x); toc();
elapsed time: 0.19214701652526855 seconds

@JeffBezanson
Copy link
Sponsor Member

Matlab's sparse takes longer if I and J are random; I wonder if an issorted() check would help. And there are many other operations in there too. This will have to be broken down.

@ViralBShah
Copy link
Member Author

If I use x = [1:100000], then we are faster than matlab as of commit c9c671b. The ranges have to eventually be expanded for storing in the sparse matrix data structure, and hence the version with ranges will be slower.

julia> tic(); s = sparse(x,x,x,100000,100000); toc();
elapsed time: 0.0044701099395752 seconds

@ghost ghost assigned ViralBShah Nov 29, 2011
@JeffBezanson
Copy link
Sponsor Member

I improved integer min and max, and now we don't need the 4th and 5th arguments to sparse to get that performance.
Pretty amazing to actually get more than a 20x speedup and now beat them :)

StefanKarpinski pushed a commit that referenced this issue Feb 8, 2018
Add entry for the cholfact(HermOrSym) family
KristofferC added a commit that referenced this issue May 9, 2018
* fix pin on repo added packages

* more pin free fixes
LilithHafner pushed a commit to LilithHafner/julia that referenced this issue Oct 11, 2021
Update badges, remove NEWS.md since it's no longer used, and fix a funny typo.
cmcaine pushed a commit to cmcaine/julia that referenced this issue Nov 11, 2022
Keno pushed a commit that referenced this issue Oct 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Must go faster
Projects
None yet
Development

No branches or pull requests

2 participants