Commit 7078f40
authored
enhance: add vector reserve to improve memory allocation in segcore (#45757)
This commit optimizes std::vector usage across segcore by adding
reserve() calls where the size is known in advance, reducing memory
reallocations during push_back operations.
Changes:
- TimestampIndex.cpp: Reserve space for prefix_sums and
timestamp_barriers
- SegmentGrowingImpl.cpp: Reserve space for binlog info vectors
- ChunkedSegmentSealedImpl.cpp: Reserve space for futures and field data
vectors
- storagev2translator/GroupChunkTranslator.cpp: Reserve space for
metadata vectors
This improves performance by avoiding multiple memory reallocations when
the vector size is predictable.
issue: #45679
---------
Signed-off-by: Buqian Zheng <[email protected]>1 parent 346449d commit 7078f40
File tree
5 files changed
+29
-0
lines changed- internal/core
- src/segcore
- storagev2translator
- thirdparty/tantivy
5 files changed
+29
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
391 | 391 | | |
392 | 392 | | |
393 | 393 | | |
| 394 | + | |
394 | 395 | | |
395 | 396 | | |
396 | 397 | | |
| |||
2672 | 2673 | | |
2673 | 2674 | | |
2674 | 2675 | | |
| 2676 | + | |
2675 | 2677 | | |
2676 | 2678 | | |
2677 | 2679 | | |
| |||
2704 | 2706 | | |
2705 | 2707 | | |
2706 | 2708 | | |
| 2709 | + | |
2707 | 2710 | | |
2708 | 2711 | | |
2709 | 2712 | | |
| |||
2754 | 2757 | | |
2755 | 2758 | | |
2756 | 2759 | | |
| 2760 | + | |
| 2761 | + | |
| 2762 | + | |
| 2763 | + | |
2757 | 2764 | | |
2758 | 2765 | | |
2759 | 2766 | | |
| |||
2774 | 2781 | | |
2775 | 2782 | | |
2776 | 2783 | | |
| 2784 | + | |
2777 | 2785 | | |
2778 | 2786 | | |
2779 | 2787 | | |
| |||
2787 | 2795 | | |
2788 | 2796 | | |
2789 | 2797 | | |
| 2798 | + | |
2790 | 2799 | | |
2791 | 2800 | | |
2792 | 2801 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1344 | 1344 | | |
1345 | 1345 | | |
1346 | 1346 | | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
| 1350 | + | |
1347 | 1351 | | |
1348 | 1352 | | |
1349 | 1353 | | |
| |||
1353 | 1357 | | |
1354 | 1358 | | |
1355 | 1359 | | |
| 1360 | + | |
1356 | 1361 | | |
1357 | 1362 | | |
1358 | 1363 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| 30 | + | |
29 | 31 | | |
30 | 32 | | |
31 | 33 | | |
| |||
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
| 92 | + | |
| 93 | + | |
92 | 94 | | |
93 | 95 | | |
94 | 96 | | |
| |||
114 | 116 | | |
115 | 117 | | |
116 | 118 | | |
| 119 | + | |
117 | 120 | | |
| 121 | + | |
118 | 122 | | |
119 | 123 | | |
120 | 124 | | |
121 | 125 | | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
122 | 129 | | |
123 | 130 | | |
124 | 131 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
355 | 355 | | |
356 | 356 | | |
357 | 357 | | |
| 358 | + | |
358 | 359 | | |
359 | 360 | | |
360 | 361 | | |
| |||
435 | 436 | | |
436 | 437 | | |
437 | 438 | | |
| 439 | + | |
438 | 440 | | |
439 | 441 | | |
440 | 442 | | |
| |||
621 | 623 | | |
622 | 624 | | |
623 | 625 | | |
| 626 | + | |
624 | 627 | | |
625 | 628 | | |
626 | 629 | | |
| |||
709 | 712 | | |
710 | 713 | | |
711 | 714 | | |
| 715 | + | |
712 | 716 | | |
713 | 717 | | |
714 | 718 | | |
| |||
726 | 730 | | |
727 | 731 | | |
728 | 732 | | |
| 733 | + | |
729 | 734 | | |
730 | 735 | | |
731 | 736 | | |
| |||
736 | 741 | | |
737 | 742 | | |
738 | 743 | | |
| 744 | + | |
739 | 745 | | |
740 | 746 | | |
741 | 747 | | |
| |||
0 commit comments