| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
If this improves speed ok.
But overall it's quite weird that it does and to me it's an indicator that we have some fundamental issues with ticks.
What exactly does the trick? _tick_group_visible or the NullLocator? I would have expected that NullLocator (i.e. major_locs == []) should not incur notable costs. format_ticks(()); get_major_ticks(0), loop over a 0-length zip should all be no cost.
By default the major ticks are on and the minor ticks of. Do you get the speed just from the minor tick branch?
Anyway a substantial cost will remain for the cases that do have ticks. Updating all ticks individually trough a loop and ticks consisting of multiple artists, that in turn have to be updated is vastly inefficient. I want to explicitly bring #5665 (comment) to attention again as a long term strategy to clean up all the tick mess.
Side note: Doc build errors are entries from https://github.com/matplotlib/matplotlib/blob/main/doc/missing-references.json.
Either the PR does change some line numbers (which regular invalidate the exceptions listed in missing-references.json), or it's something in the wake of sphinx 9.1, which has substantially reworked autodoc and known to cause issues in several docs.
Sorry, something went wrong.
|
All of the speed up in my profiling reference case comes from the minor ticks NullLocator path, mostly from not having to initialize the NullLocator object. Probably indicates some work that could be lazified, but I agree that efforts would be better spent with an overhaul. |
Sorry, something went wrong.
|
Quite interesting. NullLocator() and its parents do not even have an __init__, so it's likely the fact that we are setting up a locator or the resulting update machinery (which we're in here). |
Sorry, something went wrong.
|
Rebased to main |
Sorry, something went wrong.
…ticks_speedup
…ticks_speedup
| Back | FazBrowse Home | New Git URL |
PR summary
Towards #5665
This shortcuts major or minor ticks processing when they are set to not visible, or their locators are NullLocators. In theory, NullLocators just return an empty list, but in practice its parent class does a fair amount of work during initialization that we don't need.
Here's a representative profiling run looking at _update_ticks(). The red circled bit shows the work done by get_minorticklocs which is skipped with this PR, roughly 30% of the function call time. This is pretty significant since _update_ticks is called 3x per draw for 2D and 2x per draw for 3D plots. In my test script which draws an empty 3D plot, skipping minor ticks saves 5% of the total draw time.
PR checklist