Commit 78e6156
authored
Treat real transposes like adjoint in internal dispatch (#1296)
Since real transposes are equivalent to adjoints, we may compile methods
only for one of the two types when we are unwrapping a `Transpose`
through the `wrapperop` mechanism. This will improve the time to the
second execution in certain cases (as the same type will be re-used).
This is primarily useful in internal method dispatches where the result
of `wrapperop` will not be returned.
For example, on master
```julia
julia> using LinearAlgebra
julia> U = UpperTriangular([1 2; 3 4]);
julia> @time transpose(U) * parent(U);
0.140280 seconds (552.81 k allocations: 27.080 MiB, 99.90% compilation time)
julia> @time adjoint(U) * parent(U);
0.124338 seconds (404.18 k allocations: 19.600 MiB, 99.92% compilation time)
```
whereas, on this PR,
```julia
julia> @time transpose(U) * parent(U);
0.161032 seconds (553.25 k allocations: 27.090 MiB, 8.75% gc time, 99.91% compilation time)
julia> @time adjoint(U) * parent(U);
0.053536 seconds (356.69 k allocations: 17.240 MiB, 99.81% compilation time)
```
The second execution is noticeably faster.1 parent d21ad8c commit 78e6156
4 files changed
+26
-21
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
327 | 327 | | |
328 | 328 | | |
329 | 329 | | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
330 | 335 | | |
331 | 336 | | |
332 | 337 | | |
| |||
341 | 346 | | |
342 | 347 | | |
343 | 348 | | |
344 | | - | |
345 | | - | |
| 349 | + | |
| 350 | + | |
346 | 351 | | |
347 | 352 | | |
348 | 353 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
333 | 333 | | |
334 | 334 | | |
335 | 335 | | |
336 | | - | |
| 336 | + | |
337 | 337 | | |
338 | 338 | | |
339 | 339 | | |
340 | 340 | | |
341 | 341 | | |
342 | 342 | | |
343 | | - | |
| 343 | + | |
344 | 344 | | |
345 | 345 | | |
346 | 346 | | |
| |||
358 | 358 | | |
359 | 359 | | |
360 | 360 | | |
361 | | - | |
| 361 | + | |
362 | 362 | | |
363 | 363 | | |
364 | 364 | | |
| |||
406 | 406 | | |
407 | 407 | | |
408 | 408 | | |
409 | | - | |
| 409 | + | |
410 | 410 | | |
411 | 411 | | |
412 | 412 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
137 | | - | |
138 | | - | |
| 137 | + | |
| 138 | + | |
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
143 | | - | |
144 | | - | |
| 143 | + | |
| 144 | + | |
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
| |||
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
153 | | - | |
| 153 | + | |
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
159 | | - | |
| 159 | + | |
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
| |||
1031 | 1031 | | |
1032 | 1032 | | |
1033 | 1033 | | |
1034 | | - | |
| 1034 | + | |
1035 | 1035 | | |
1036 | 1036 | | |
1037 | 1037 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1105 | 1105 | | |
1106 | 1106 | | |
1107 | 1107 | | |
1108 | | - | |
| 1108 | + | |
1109 | 1109 | | |
1110 | | - | |
| 1110 | + | |
1111 | 1111 | | |
1112 | | - | |
| 1112 | + | |
1113 | 1113 | | |
1114 | | - | |
| 1114 | + | |
1115 | 1115 | | |
1116 | 1116 | | |
1117 | | - | |
| 1117 | + | |
1118 | 1118 | | |
1119 | | - | |
| 1119 | + | |
1120 | 1120 | | |
1121 | 1121 | | |
1122 | 1122 | | |
| |||
1168 | 1168 | | |
1169 | 1169 | | |
1170 | 1170 | | |
1171 | | - | |
| 1171 | + | |
1172 | 1172 | | |
1173 | | - | |
| 1173 | + | |
1174 | 1174 | | |
1175 | 1175 | | |
1176 | 1176 | | |
| |||
0 commit comments