Skip to content
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

Numpy.array elementwise comparison to None very slow in backend_pdf.py #3915

Closed
Gerenuk opened this issue Dec 12, 2014 · 3 comments
Closed

Comments

@Gerenuk
Copy link

Gerenuk commented Dec 12, 2014

When using the PDF backend with

fig.savefig(filename, format="PDF", bbox_inches="tight")

it may end up comparing None to a numpy.array which can be very slow if the array is large. This happens at line 2264 in backend_pdf.py in GraphicsContextPdf.delta() with the line

different = bool(ours != theirs)

It happens that ours is None and theirs a numpy.array. Due to the (new?) numpy behaviour using element-wise comparison here, this steps turns out to be very slow.
(matplotlib 1.4.0, numpy 1.9.0)

@jenshnielsen
Copy link
Member

I think this has been fixed on master already by #3718 but perhaps it is worth back porting it to 1.4.3?

@tacaswell
Copy link
Member

Yeah, I agree that it should be back-ported, doing it now.

@tacaswell
Copy link
Member

back ported as 431edb7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants