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 upPotential optimization opportunity in supervised.cpp #34
Comments
|
Thanks a lot. I think that part of the code was translated directly from the Python and I forgot to go back and make any sort of optimization or C++ify it. Would you be interested in creating a PR and adding yourself to the author list as a contributor in the DESCRIPTION? I already have a couple of tests around |
Looking at:
uwot/src/supervised.cpp
Lines 71 to 75 in 3e359a3
This seems like it could be replaced by a binary search, assuming that the inputs represent slots from a
dgCMatrix; entries ofishould always be sorted within each column specified byp.This should be faster for any decently sized input matrix where you're getting >100 non-zero entries in each column (I don't know if this is particularly common?), and saves two lines as well.
(Not that I have any concerns about speed; I was trawling through the code for other reasons and just happened to notice this. Just something to consider.)