-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
vectorizing some trisurf functions for performance improvement #472
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
Conversation
@choldgraf My suggestion to reduce execution time referred to an initial code for trisurf. Here that proposal amounts to changing the lines 1575-1593 as follows:
Emilia |
8dac4a6
to
d830701
Compare
Good point - I've made these edits w/ a few modifications to vectorize. I think it should be doing the same thing, but someone should double check to make sure that I didn't change something. I compared the new vs old codebase and it seems like the outputs are pretty much the same (with one difference being the call to Without lines plotting the speedup went from ~17 seconds to ~2-3 seconds However, I also noticed that there aren't any tests that cover trisurf, so I suppose it doesn't matter that tests still pass :) that should probably be done, but I don't have time left today to write a full set of tests for the function... |
d830701
to
7a15095
Compare
Nice! Thanks @choldgraf and @empet ! 💃 from me |
I can start writing tests. |
Sounds good, lmk if I can help. Do you want tests in this PR or in another? Sent from my phone, apologies for the curtness and type-os
|
else: | ||
x_edge = [] | ||
y_edge = [] | ||
z_edge = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool logic.
This looks good to me, the logic holds up, and with some speed increases for the few examples I tried out. Going to wait for those tests for a more exhaustive look. |
I'm getting some test failures. Checking it out now. |
cool - if you push the tests to master then I can rebase and change things On Tue, May 24, 2016 at 2:13 PM, Adam Kulidjian notifications@github.com
|
So the test failure was just because I hadn't updated my expected tri_surf plot for the test_trisurf_kwargs(). I am currently working on another PR #477 where I have allowed for a list of more than 2 colors to pass into trisurf. What exactly should I be writing tests for here and can I do it here without worrying about merging this Plus_2_Colorscale PR I have? |
@choldgraf and @Kully There is a test that covers trisurf output: I'd imagine that this test would be sufficient for now. @Kully if all the current tests are passing, can we merge it? |
New PR with passing tests: |
Sounds good all - after this one I'll take comments to the new PR. @theengineear I don't know how I missed those trisurf tests, I just did a ctrl-f for |
First pass at optimizing some of the trisurf machinery. This basically just vectorizes things where it used to use list comprehensions / loops. I also tried to make functions accept a vector of inputs rather than a single number as an input to reduce redundant computation etc. Might have missed some things, but for me this brought the
_trisurf
function from ~16 seconds to ~2 seconds (!).We should make sure that the outputs are the same, but I ran nosetests on
test_figure_factory.py
and it passed for me. If you all like the changes, then I can clean up the comments and change docstrings as necessary.WDYT? @jackparmer @Kully (couldn't find Emilia's handle w/ a quick search, sorry if I'm missing other folks)