Prf mouse move hitlist#4813
Merged
jenshnielsen merged 2 commits intomatplotlib:masterfrom Jul 30, 2015
Merged
Conversation
Looking up MachAr was taking about 10ms which is way to slow to be inside of the mouse motion event loop. We are using it to get a constant so we can look it up and compute the constant once at the top.
Member
Author
|
@joferkington Do you work around this sort of thing in |
This was referenced Jul 29, 2015
Closed
Member
|
@tacaswell, I profiled a plot with 10000 random segments, and the |
Member
|
Granted, it was a single |
Member
|
Otherwise, I agree that an artist should be able to opt out of mouse-move hit testing. |
Member
|
This is a significant when testing on a plot with 100 lines. We might need to do more however I don't see any reason to hold this back |
This was referenced Aug 11, 2015
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This address some of #4767.
The issue in 604299f is that
np.MachAr(float).xmintakes ~8-10 ms and gets 2x in thehitlistcode path. Moving this to a constant at the top is a major speed up and for a blank figure gets the hitlist run time down to 5-6ms from a bit over 20ms (on the computer I was testing on).There is still an issue that sorting out if the cursor hits a
Line2Dartist takes at least 1ms so if you have 300 lines, it takes a third of a second for the callback to run.Long term, we should look into making this code faster by making contains run faster (a lot of time is spent in https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/lines.py#L36), by finding a way to cache this in a smart way but in the short term I think we need to add a per-axes way of turning this off and probably default to off.
attn @blink1073 @mdboom @pwuertz