-
-
Notifications
You must be signed in to change notification settings - Fork 18k
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
PERF: load plotting entrypoint only when necessary #41503
Conversation
TLouf
commented
May 16, 2021
•
edited
Loading
edited
- closes ENH: load plotting entry point only when necessary #41492
- tests added / passed (I only ran plotting/test_backend.py, which seemed appropriate)
- Ensure all linting tests pass, see here for how to run them
- whatsnew entry
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.
is there some way to actually test this?
A first thing I see in A second is to test whether |
how do we know that this is better perf wise? we don't have any registered backends in pandas tests (I think). I am very leary of changing this as last time this broke things for a while as its pretty fragile. If we have some testsing & perf benchmarks would feel better here. |
I've added a benchmark that runs Here's the output from
I'm surprised by how low the measured times are, when I run the same thing outside of Edit: had already tried setting
|
@TLouf 1000 is not realistic, let's see 10 |
It's not realistic in terms of number of backends, but these are also extremely fast to load, as opposed to some real plotting backends. As I mentioned in the issue, Anyway, here's the result with 10:
|
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.
a few comments, pls rebase as well
Introduces `_load_backend` instead of `_find_backend`, which has a better defined role, and can also handle backend='matplotlib'
Done. I had to add a boolean |
# Fall back to unregistered, module name approach. | ||
try: | ||
module = importlib.import_module(backend) | ||
found_backend = True |
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.
what i meant is that you can move all of this code here to L1766 (e.g. just load and import there) right?
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 don't think so, I first have to iterate through all entry points before falling back to importing a module. That's because for instance, the hvPlot backend is an entry point whose name
is "holoviews" (see https://github.com/holoviz/hvplot/blob/master/setup.py#L134). So if I move up the unregistered entry point approach, in that case I might import holoviews, which has no top level plot
method, thus raising when the entry point is actually available.
thanks @TLouf |