Commit d5fb42a
committed
perf: pre-allocate values list in BoundStatement.bind()
Replace empty list + repeated append() with pre-allocated list and index
assignment in BoundStatement.bind(). For protocol v4+, the list is
initialized to [UNSET_VALUE] * col_meta_len, eliminating the separate
trailing UNSET_VALUE padding loop entirely. For protocol v3, the list is
initialized to [None] * value_len.
This avoids repeated list resizing and reduces Python bytecode overhead
per bound value (index assignment vs method lookup + call for append).
The routing key validation for UNSET_VALUE is preserved: explicit
UNSET_VALUE binds are checked inline, and implicitly padded trailing
columns are validated in a separate loop after the main bind loop.
Part of: #7511 parent 9c53d78 commit d5fb42a
1 file changed
Lines changed: 24 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
635 | 635 | | |
636 | 636 | | |
637 | 637 | | |
638 | | - | |
639 | | - | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
640 | 648 | | |
641 | | - | |
| 649 | + | |
642 | 650 | | |
643 | 651 | | |
644 | | - | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
645 | 656 | | |
646 | 657 | | |
647 | 658 | | |
| |||
652 | 663 | | |
653 | 664 | | |
654 | 665 | | |
655 | | - | |
| 666 | + | |
656 | 667 | | |
657 | 668 | | |
658 | 669 | | |
659 | 670 | | |
660 | 671 | | |
661 | 672 | | |
662 | | - | |
663 | | - | |
664 | | - | |
665 | | - | |
666 | | - | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
667 | 681 | | |
668 | 682 | | |
669 | 683 | | |
| |||
0 commit comments