Commit 521699c
committed
precompute all possible ml-matches lookup results
Store full method interference relationship graph in interferences field
of Method to avoid expensive morespecific calls during dispatch. This
provides significant performance improvements:
- Replace method comparisons with precomputed interference lookup.
- Optimize ml_matches minmax computation using interference lookups.
- Optimize sort_mlmatches for large return sets by iterating over
interferences instead of all matching methods.
- Add method_morespecific_via_interferences in both C and Julia.
This representation may exclude some edges that are implied by
transitivity since sort_mlmatches will ensure the correct result by
following strong edges. Ambiguous edges are guaranteed to be checkable
without recursion.
Also fix a variety of bugs along the way:
- Builtins signature would cause them to try to discard all other
methods during `sort_mlmatches`.
- Some ambiguities were over-estimated, which now are improved upon.
- Setting lim==-1 now gives the same limited list of methods as lim>0,
since that is actually faster now than attempting to give the
unsorted list. This provides a better fix to #53814 than #57837 and
fixes #58766.
- Reverts recent METHOD_SIG_LATEST_HAS_NOTMORESPECIFIC attempt (though
not the whole commit), since I found a significant problem with any
usage of that bit during testing: it only tracks methods that
intersect with a target, but new methods do not necessarily intersect
with any existing target.
This provides a decent performance improvement to `methods` calls, which
implies a decent speed up to package loading also (e.g. ModelingToolkit
loads in about 4 seconds instead of 5 seconds).1 parent 67634fe commit 521699c
File tree
15 files changed
+793
-530
lines changed- base
- src
- stdlib/Test/src
- test
15 files changed
+793
-530
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
267 | 267 | | |
268 | 268 | | |
269 | 269 | | |
| 270 | + | |
270 | 271 | | |
| 272 | + | |
271 | 273 | | |
272 | 274 | | |
273 | 275 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
465 | 465 | | |
466 | 466 | | |
467 | 467 | | |
| 468 | + | |
468 | 469 | | |
469 | 470 | | |
470 | 471 | | |
471 | 472 | | |
472 | 473 | | |
473 | 474 | | |
474 | 475 | | |
475 | | - | |
| 476 | + | |
476 | 477 | | |
477 | 478 | | |
478 | 479 | | |
| |||
494 | 495 | | |
495 | 496 | | |
496 | 497 | | |
497 | | - | |
498 | | - | |
| 498 | + | |
| 499 | + | |
499 | 500 | | |
500 | 501 | | |
501 | 502 | | |
| |||
640 | 641 | | |
641 | 642 | | |
642 | 643 | | |
| 644 | + | |
643 | 645 | | |
644 | 646 | | |
645 | 647 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
| 81 | + | |
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| |||
218 | 218 | | |
219 | 219 | | |
220 | 220 | | |
221 | | - | |
222 | | - | |
| 221 | + | |
223 | 222 | | |
224 | 223 | | |
225 | 224 | | |
| |||
424 | 423 | | |
425 | 424 | | |
426 | 425 | | |
427 | | - | |
428 | | - | |
| 426 | + | |
429 | 427 | | |
430 | 428 | | |
431 | 429 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1478 | 1478 | | |
1479 | 1479 | | |
1480 | 1480 | | |
1481 | | - | |
1482 | | - | |
1483 | | - | |
1484 | | - | |
1485 | | - | |
1486 | | - | |
1487 | | - | |
1488 | | - | |
1489 | | - | |
| 1481 | + | |
1490 | 1482 | | |
1491 | 1483 | | |
1492 | 1484 | | |
| |||
0 commit comments