Open
Description
Right now, each Axis
has a two lists of Tick
objects (one major, one minor), each of which has 3 Line
objects (for left tick, right tick and gridline) and 2 Text
objects (for main and secondary label). Constructing Line
objects is rather heavy and expensive. Refactoring this code so that each Axis
had 3 LineCollection
objects instead where only the points of the ticks needs to be updated, sharing all of the line style information, should be much faster.
On the following simple benchmark:
plt.subplots(8, 8)
plt.savefig('test.png')
25% of the time is spent constructing the Line
objects. The suggested change above should reduce the number of Line
objects from 3*N (where N is the number of ticks, usually a dozen or so) to 3.