Skip to content

Commit

Permalink
executor: pre-allocate memory for slices (pingcap#5071)
Browse files Browse the repository at this point in the history
  • Loading branch information
zz-jason authored and tiancaiamao committed Nov 13, 2017
1 parent cedc35c commit 6f8db31
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions executor/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,8 @@ func (b *executorBuilder) buildMergeJoin(v *plan.PhysicalMergeJoin) Executor {
}

func (b *executorBuilder) buildHashJoin(v *plan.PhysicalHashJoin) Executor {
var leftHashKey, rightHashKey []*expression.Column
leftHashKey := make([]*expression.Column, 0, len(v.EqualConditions))
rightHashKey := make([]*expression.Column, 0, len(v.EqualConditions))
for _, eqCond := range v.EqualConditions {
ln, _ := eqCond.GetArgs()[0].(*expression.Column)
rn, _ := eqCond.GetArgs()[1].(*expression.Column)
Expand Down Expand Up @@ -584,7 +585,8 @@ func (b *executorBuilder) buildHashJoin(v *plan.PhysicalHashJoin) Executor {
}

func (b *executorBuilder) buildSemiJoin(v *plan.PhysicalHashSemiJoin) *HashSemiJoinExec {
var leftHashKey, rightHashKey []*expression.Column
leftHashKey := make([]*expression.Column, 0, len(v.EqualConditions))
rightHashKey := make([]*expression.Column, 0, len(v.EqualConditions))
for _, eqCond := range v.EqualConditions {
ln, _ := eqCond.GetArgs()[0].(*expression.Column)
rn, _ := eqCond.GetArgs()[1].(*expression.Column)
Expand Down

0 comments on commit 6f8db31

Please sign in to comment.