Skip to content

Commit 646ea2a

Browse files
ttsugriymeta-codesync[bot]
authored andcommitted
perf: Reserve space for holders_ in DecodedArgs constructor (#15418)
Summary: Pull Request resolved: #15418 The DecodedArgs constructor was populating the holders_ vector without pre-allocating space, which could cause multiple reallocations as the vector grows. This adds a reserve() call before the loop to allocate space upfront for all elements, improving performance by avoiding unnecessary allocations and copies. Reviewed By: Yuhta Differential Revision: D86366246 fbshipit-source-id: ded985a5a2410b578a97626d2f6e7d88654750eb
1 parent 746d257 commit 646ea2a

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

velox/expression/DecodedArgs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ class DecodedArgs {
3636
const SelectivityVector& rows,
3737
const std::vector<VectorPtr>& args,
3838
exec::EvalCtx& context) {
39+
holders_.reserve(args.size());
3940
for (auto& arg : args) {
4041
holders_.emplace_back(context, *arg, rows);
4142
}

0 commit comments

Comments
 (0)