-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
fix rendering slowdown with big invisible lines (issue #1256) #1531
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
I just realized that when I introduced my testcase in |
@@ -484,6 +484,9 @@ def _is_sorted(self, x): | |||
|
|||
@allow_rasterization | |||
def draw(self, renderer): | |||
"draw the Line with `renderer` unless visiblity is False" |
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.
I know it is not consistent throughout mpl, but we are trying to standardise on the """
style docstring. Would you mind updating?
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.
Done! I usually use triple quotes too, but I wanted to follow some convention so I had just looked at a function a few lines above... which has single quotes ;-)
@pierre-haessig : Thanks for doing this. It is a very useful fix which, as is, provides a good improvement in performance for large, non visible lines. As you can see, I've posted a couple of comments, none of which are major, but I have raised a question on the mpl-devel mailinglist about a possible alternative approach to resolving (and testing) this issue. I think we should hang fire on merging this for a couple of days/week(s) until that discussion has happened, but if the decision is against my proposal, what you have implemented here is the correct way to go. Thanks again for doing this, Phil |
@pelson : Thank you very much for your feedback. I've updated the README to only redirects people to devel doc. To answer @mdboom question about the new docs, I found the testing section immensely useful, because first I was very frustrated of my test not being found (I'm not familiar with nose, but I thought there was some automatic test discovery feature... ). Then I found the solution by looking into the docs and that's why I made this small copy pasting which I agree is a pretty bad practice... |
About Travis build failing, I don't know what to do. Something is going wrong in the This being said, I have no clue why the test wants to create a 800x600 image, especially since figure size is set by |
Yes. Whenever you use Hope that does it! |
@pelson, thanks for the explanation about the I suggest to use the |
Thanks to @pelson's help, there is no more Travis build failure :-) Now I see two remaining issues:
|
@pierre-haessig You don't need to incorporate the latest changes from master. At present, your pull request will merge cleanly in its current state. However if you wish to tidy up your commit history, you will need to interactively rebase the last 5 commits with |
@dmcdougall I dived back in Pro Git book and ran
However, I see no effect on my commit history (I still see the 5 separate commits). I suspect it may relate to the fact I'm not working on a topic branch but on my master branch (which prooves itself pretty annoying...). If you have any further git tips, I'll be glad to play a bit more ;-) |
@pierre-haessig Sounds like when you ran it, an editor popped up and you didn't change anything. If you try it again, read the stuff at the bottom of the text file that pops up. You can change commit messages and squash commits and such like. Let me know how you get on. |
About the fix: Line2D.draw method now *returns immediately*, if the Line is invisible (get_visible() returns False). In particular, the `self.recache` and `self._transform_path` calls are short-circuited. In addition to the bugfix: * adds a test case for lines rendering speed (issue matplotlib#1256) * adds a README in `matplotlib.tests` to redirect people to the testing section of the development guide.
@dmcdougall, you're right, I didn't change anything when the text editor popped up because I thought the default proposition was fine... I was wrong. I pushed with the |
@pierre-haessig I dig the verbose commit message. Thanks. I'll let Travis finish up the test just for sanity's sake. @pelson It appears, judging by the feedback on the mailing list, that the use of Meta on Artist is not encouraged in its most general setting. Are you happy with the solution presented here? |
Yep. Good work @pierre-haessig 👍 |
fix rendering slowdown with big invisible lines (issue #1256)
Thank you all for your kind help and thanks for merging so fast. With this tiny PR, I've learned a lot about git, mpl testing and mpl code. |
Great to hear! We're always looking for contributors such as yourself and I hope this experience has encouraged you to get involved and submit further mpl pull requests 😄. Cheers, |
tiny change in
Line2D.draw
to return immediately if the line is not visible.This avoids annoying rendering slowdown with big Line2D objects (say lines holding about 10**7 points)