Commit 32f6824
committed
avoid method proliferation for
* Introducing new types and methods for a callable can invalidate
already compiled method instances of a function for which
world-splitting is enabled (`max_methods`).
* Invalidation of sysimage or package precompiled code worsens latency
due to requiring recompilation.
* Lowering the `max_methods` setting for a function often causes
inference issues for existing code that is not completely
type-stable (which is a lot of code). In many cases this is easy to
fix by avoiding method proliferation, such as by merging some methods
and introducing branching into the merged method.
This PR aims to fix the latter issue for some `Tuple`-related methods
of some functions where decreasing `max_methods` might be interesting.
Seeing as branching was deliberately avoided in the bodies of many of
these methods, I opted for the approach of introducing local functions
which preserve the dispatch logic as before, without branching. Thus
there should be no regressions, except perhaps because of changed
inlining costs.
This PR is a prerequisite for PRs which try to decrease `max_methods`
for select functions, such as PR:
* JuliaLang#59377Tuple functions1 parent 8d953e1 commit 32f6824
4 files changed
+102
-59
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
533 | 533 | | |
534 | 534 | | |
535 | 535 | | |
536 | | - | |
537 | | - | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
538 | 544 | | |
539 | 545 | | |
540 | 546 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
223 | 223 | | |
224 | 224 | | |
225 | 225 | | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | 226 | | |
234 | 227 | | |
235 | 228 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
263 | 263 | | |
264 | 264 | | |
265 | 265 | | |
266 | | - | |
267 | | - | |
268 | | - | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
269 | 274 | | |
270 | 275 | | |
271 | 276 | | |
| |||
577 | 582 | | |
578 | 583 | | |
579 | 584 | | |
580 | | - | |
581 | | - | |
582 | | - | |
583 | | - | |
584 | | - | |
585 | | - | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
586 | 594 | | |
587 | | - | |
| 595 | + | |
588 | 596 | | |
589 | 597 | | |
590 | | - | |
591 | | - | |
592 | | - | |
593 | 598 | | |
594 | | - | |
595 | | - | |
596 | | - | |
597 | | - | |
598 | | - | |
599 | | - | |
600 | | - | |
601 | | - | |
602 | | - | |
603 | | - | |
604 | | - | |
605 | | - | |
606 | | - | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
607 | 604 | | |
608 | 605 | | |
609 | 606 | | |
610 | 607 | | |
611 | | - | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
612 | 622 | | |
| 623 | + | |
613 | 624 | | |
614 | | - | |
| 625 | + | |
615 | 626 | | |
616 | 627 | | |
617 | | - | |
618 | | - | |
619 | | - | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
620 | 633 | | |
621 | 634 | | |
622 | 635 | | |
623 | 636 | | |
624 | 637 | | |
625 | 638 | | |
626 | 639 | | |
627 | | - | |
628 | | - | |
629 | | - | |
630 | | - | |
631 | | - | |
632 | | - | |
633 | | - | |
634 | | - | |
635 | | - | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
636 | 654 | | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
637 | 663 | | |
638 | | - | |
| 664 | + | |
639 | 665 | | |
640 | 666 | | |
641 | 667 | | |
642 | 668 | | |
643 | | - | |
644 | | - | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
645 | 674 | | |
646 | 675 | | |
647 | 676 | | |
| |||
679 | 708 | | |
680 | 709 | | |
681 | 710 | | |
682 | | - | |
683 | | - | |
684 | | - | |
685 | | - | |
686 | | - | |
687 | | - | |
688 | | - | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
689 | 721 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
824 | 824 | | |
825 | 825 | | |
826 | 826 | | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
827 | 839 | | |
828 | 840 | | |
829 | 841 | | |
| |||
0 commit comments