Commit 19e5ce5
committed
Avoid TransformedBbox where unneeded.
transform_bbox is much faster when one does not need a TransformedBbox,
i.e. something that keeps track of later changes in the transform:
```
In [1]: from pylab import *
...: from matplotlib.transforms import *
...: tr = plt.gca().transAxes
...: bb = Bbox([[0, 0], [1, 1]])
...: %timeit TransformedBbox(bb, tr).x0
...: %timeit tr.transform_bbox(bb).x0
...: %timeit TransformedBbox(bb, tr).width
...: %timeit tr.transform_bbox(bb).width
11.8 µs ± 145 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)
2.72 µs ± 31.5 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)
11.9 µs ± 183 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)
2.83 µs ± 16.6 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)
```1 parent f2ada0c commit 19e5ce5
File tree
3 files changed
+4
-7
lines changed- lib
- matplotlib
- mpl_toolkits/axes_grid1
3 files changed
+4
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
61 | | - | |
62 | 60 | | |
63 | 61 | | |
64 | | - | |
| 62 | + | |
65 | 63 | | |
66 | 64 | | |
67 | 65 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
88 | | - | |
| 87 | + | |
89 | 88 | | |
90 | 89 | | |
91 | 90 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
129 | | - | |
| 129 | + | |
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
| |||
0 commit comments