Skip to content

Commit a3a3aac

Browse files
ttsugriyfacebook-github-bot
authored andcommitted
perf: Reserve space for holders_ in DecodedArgs constructor (facebookincubator#15418)
Summary: 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
1 parent e681772 commit a3a3aac

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)