PERF: More speedups#31004
Conversation
d98d0a3 to
8efa833
Compare
5f81d43 to
c93b6ec
Compare
timhoffm
left a comment
There was a problem hiding this comment.
As a general feedback, I'm somewhat hesitant on the changes. While I believe your overall profiling and speed-up claims, I'm unclear which changes contribute in which amount.
Typically, the changes here come with increased code complexity and lower readability. Therefore, I would like to only include the changes that really matter.
Fix tests
Fix tests
Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>
e671c25 to
26650f8
Compare
|
I cleaned some stuff up, the remaining changes are all impactful (across different profiler cases, this is a bit of a grab-bag of updates so difficult to show one script with a clean difference). I think the one borderline decision is putting in a sentinel case for import time
import numpy as np
import matplotlib.pyplot as plt
print("Starting...")
fig, ax = plt.subplots()
x = y = np.linspace(-1, 1, 10000)
print("Timing...")
start_time = time.perf_counter()
for i in range(1000):
ax.plot(x + i, y)
fig.canvas.draw()
end_time = time.perf_counter()
plt.close()
print(f"Time taken: {end_time - start_time:.4f} seconds") |
timhoffm
left a comment
There was a problem hiding this comment.
We should make cbook.STEP_LOOKUP_MAP private and eventually remove the "default" key since we don't use it anymore in our code. But that's a cleanup that can be done in a separte PR.
…more_speedups
…more_speedups
PR summary
A collection of a few more speedups from profiling large 2D line, scatter, and fill_between plots. I didn't record my profiling runs for all these changes, but saw a ~40% speedup for a plot with 100x 5000-point lines.
Bbox.update_from_pathgets another fast pathPR checklist