Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Improve Line2D and MarkerStyle instantiation #6694
Conversation
mdboom
added the
needs_review
label
Jul 5, 2016
Kojoley
and 1 other
commented on an outdated diff
Jul 5, 2016
| @@ -229,7 +230,9 @@ def set_fillstyle(self, fillstyle): | ||
| raise ValueError("Unrecognized fillstyle %s" | ||
| % ' '.join(self.fillstyles)) | ||
| self._fillstyle = fillstyle | ||
| - self._recache() | ||
| + # do not call _recache() if marker is not yet set up | ||
| + if self._marker is not None: |
Kojoley
Member
|
tacaswell
commented on an outdated diff
Jul 6, 2016
| @@ -175,11 +175,12 @@ def __init__(self, marker=None, fillstyle=None): | ||
| fillstyle : string, optional, default: 'full' | ||
| 'full', 'left", 'right', 'bottom', 'top', 'none' | ||
| """ | ||
| - # The fillstyle has to be set here as it might be accessed by calls to | ||
| - # _recache() in set_marker. | ||
| - self._fillstyle = fillstyle | ||
| - self.set_marker(marker) | ||
| + # The _recache() is called in both set_fillstyle() and set_marker() | ||
| + # methods that's why here we have to have either marker or fillstyle | ||
| + # preinitialized before setting other. | ||
| + self._marker = None |
tacaswell
Owner
|
|
I have pushed alternative solution for double What about moving out initialization from |
|
I suspect that not all of the |
tacaswell
added this to the
2.1 (next point release)
milestone
Jul 6, 2016
|
Yes, I can confirm this as I have already tried it. |
Kojoley commentedJul 5, 2016
This reduces
MarkerStyle._recache()calls from 4 to 1 inLine2Dinstantiation