Title: Optimise `Axes.add_patch` to avoid python iteration over bezier segments by tpgillam · Pull Request #28657 · matplotlib/matplotlib · GitHub
Open Graph Title: Optimise `Axes.add_patch` to avoid python iteration over bezier segments by tpgillam · Pull Request #28657 · matplotlib/matplotlib
X Title: Optimise `Axes.add_patch` to avoid python iteration over bezier segments by tpgillam · Pull Request #28657 · matplotlib/matplotlib
Description: PR summary This aims to optimise calls to _AxesBase.add_patch, where the patch might have a path with many bezier segments. This is done by avoiding a long loop in python, and instead delegating to BBox.update_from_path, which is used when updating limits from other artists. This provides a ~5x speedup for a call to _AxesBase.add_patch in some of our internal code, with complicated patches with hundreds of bezier segments. Implementation notes The implementation is effectively the same as that in _AxesBase._update_line_limits also in this class. It performs the iteration in C++ (in _path.h::update_path_extents). This is the same approach as used for collections of patches; i.e. the rescaling behaviour is now as performant as: axes.add_collection(PatchCollection([patch])) PR checklist WIP: trying but so far have failed to get the test suite running locally. I followed steps to create necessary venv and build, but running pytest just hangs indefinitely without consuming any resources. I can however import the local build of matplotlib and perform basic tasks with it by hand. [N/A] "closes #0000" is in the body of the PR description to link the related issue new and changed code is tested Plotting related features are demonstrated in an example [N/A] New Features and API Changes are noted with a directive and release note Documentation complies with general and docstring guidelines
Open Graph Description: PR summary This aims to optimise calls to _AxesBase.add_patch, where the patch might have a path with many bezier segments. This is done by avoiding a long loop in python, and instead delegating to...
X Description: PR summary This aims to optimise calls to _AxesBase.add_patch, where the patch might have a path with many bezier segments. This is done by avoiding a long loop in python, and instead delegating to...
Opengraph URL: https://github.com/matplotlib/matplotlib/pull/28657
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:51bd84ad-384f-c3fd-8594-c0bc91274d8b |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 8DE0:1874B4:4CF9A2:6732BB:6A5196D4 |
| html-safe-nonce | 3d08160bc33f19efae7ffa39d6dcc40960204f1f6a70b1ccb03ef970f31226d8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4REUwOjE4NzRCNDo0Q0Y5QTI6NjczMkJCOjZBNTE5NkQ0IiwidmlzaXRvcl9pZCI6IjUwMDMwMjQwMDk3OTA1OTI3MjQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 80ef317904cd2c339db100ec2132cde87d4f914501d9e17aa4eef5b0c2995ef7 |
| hovercard-subject-tag | pull_request:2002000937 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/matplotlib/matplotlib/pull/28657/files |
| twitter:image | https://avatars.githubusercontent.com/u/7052222?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/7052222?s=400&v=4 |
| og:image:alt | PR summary This aims to optimise calls to _AxesBase.add_patch, where the patch might have a path with many bezier segments. This is done by avoiding a long loop in python, and instead delegating to... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/matplotlib/matplotlib git https://github.com/matplotlib/matplotlib.git |
| octolytics-dimension-user_id | 215947 |
| octolytics-dimension-user_login | matplotlib |
| octolytics-dimension-repository_id | 1385122 |
| octolytics-dimension-repository_nwo | matplotlib/matplotlib |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1385122 |
| octolytics-dimension-repository_network_root_nwo | matplotlib/matplotlib |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7aed05249554b889eb33d002851a973eebcc7e91 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width