Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign updgt2dgc is slower than native Armadillo version #173
Comments
|
Thanks for pointing that out. When I wrote the conversion |
|
Just done with the check of |
During my last dive in sparse matrix code, I came across multiple uses of
.push_back(...)when building some vectors, e.g. around RcppArmadilloAs.h:178. It is used notably in the code converting dgt matrices to default dgc type (may be somewhere else too, I didn't check). Such vector building method can require big number of memory operations that are known to be relatively slow. Yet there is already native armadillo code for batch building dgc matrices from triplets ijv. My test shows that the native method is much faster on big matrices, e.g. on 3000x4000 randomly sparse matrix with about 8000 non zero entries, actual code converts such matrix in 4.5 ms while native batch construction takes only 0.9 ms on my Intel Xeon E5-2609 v2 @ 2.50GHz.I think we could rely on native batch construction not only for the speed but also simply for avoiding code duplication.
Here is my test code:
If you decide to go in this direction, I can prepare a patch request.