Commit b6f612c
perf(sorted_map,sorted_set): update height before the consuming store in rotate_l/rotate_r
With #owned(n), storing n into the rotated node consumes the reference;
calling n.update_height() after the store forced the compiler to keep n
alive across it. Hoisting the height update (n's children are final at
that point) makes the store the last use: sorted_map rotations drop
from 3 incref/2 decref (borrowed baseline) to 1/1.1 parent 18dd827 commit b6f612c
2 files changed
Lines changed: 12 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
598 | 598 | | |
599 | 599 | | |
600 | 600 | | |
601 | | - | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
602 | 604 | | |
| 605 | + | |
603 | 606 | | |
604 | 607 | | |
605 | 608 | | |
| |||
609 | 612 | | |
610 | 613 | | |
611 | 614 | | |
612 | | - | |
| 615 | + | |
613 | 616 | | |
| 617 | + | |
614 | 618 | | |
615 | 619 | | |
616 | 620 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
612 | 612 | | |
613 | 613 | | |
614 | 614 | | |
615 | | - | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
616 | 618 | | |
| 619 | + | |
617 | 620 | | |
618 | 621 | | |
619 | 622 | | |
| |||
623 | 626 | | |
624 | 627 | | |
625 | 628 | | |
626 | | - | |
| 629 | + | |
627 | 630 | | |
| 631 | + | |
628 | 632 | | |
629 | 633 | | |
630 | 634 | | |
| |||
0 commit comments