Commit a4b09af
committed
Micro optimize LWLockAttemptLock() a bit.
LWLockAttemptLock pointlessly read the lock's state in every loop
iteration, even though pg_atomic_compare_exchange_u32() returns the old
value. Instead do that only once before the loop iteration.
Additionally there's no need to have the expected_state variable,
old_state mostly had the same value anyway.
Noticed-By: Heikki Linnakangas
Backpatch: 9.5, no reason to let the branches diverge at this point1 parent 7039760 commit a4b09af
1 file changed
+12
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
582 | 582 | | |
583 | 583 | | |
584 | 584 | | |
| 585 | + | |
| 586 | + | |
585 | 587 | | |
586 | 588 | | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
587 | 595 | | |
588 | 596 | | |
589 | 597 | | |
590 | | - | |
591 | | - | |
592 | 598 | | |
593 | 599 | | |
594 | 600 | | |
595 | | - | |
596 | | - | |
597 | | - | |
| 601 | + | |
598 | 602 | | |
599 | 603 | | |
600 | 604 | | |
601 | | - | |
| 605 | + | |
602 | 606 | | |
603 | 607 | | |
604 | 608 | | |
605 | 609 | | |
606 | 610 | | |
607 | | - | |
| 611 | + | |
608 | 612 | | |
609 | 613 | | |
610 | 614 | | |
| |||
620 | 624 | | |
621 | 625 | | |
622 | 626 | | |
623 | | - | |
| 627 | + | |
624 | 628 | | |
625 | 629 | | |
626 | 630 | | |
| |||
0 commit comments