Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expression: implement vectorized evaluation for builtinAbsRealSig #12273

Merged
merged 6 commits into from
Sep 23, 2019
Merged

expression: implement vectorized evaluation for builtinAbsRealSig #12273

merged 6 commits into from
Sep 23, 2019

Conversation

tsthght
Copy link
Contributor

@tsthght tsthght commented Sep 19, 2019

What problem does this PR solve?

implement vectorized evaluation for builtinAbsRealSig , for #12105

What is changed and how it works?

goos: darwin
goarch: amd64
pkg: github.com/pingcap/tidb/expression
BenchmarkVectorizedBuiltinMathFunc/builtinAbsRealSig-VecBuiltinFunc-8         	  500000	      3174 ns/op	       0 B/op	       0 allocs/op
BenchmarkVectorizedBuiltinMathFunc/builtinAbsRealSig-NonVecBuiltinFunc-8      	  100000	     21304 ns/op	       0 B/op	       0 allocs/op

Check List

Tests

  • Unit test

@sre-bot sre-bot added the contribution This PR is from a community contributor. label Sep 19, 2019
@codecov
Copy link

codecov bot commented Sep 19, 2019

Codecov Report

Merging #12273 into master will not change coverage.
The diff coverage is n/a.

@@             Coverage Diff             @@
##             master     #12273   +/-   ##
===========================================
  Coverage   81.0961%   81.0961%           
===========================================
  Files           454        454           
  Lines         98906      98906           
===========================================
  Hits          80209      80209           
  Misses        12913      12913           
  Partials       5784       5784

@qw4990 qw4990 self-requested a review September 22, 2019 06:31
Copy link
Member

@zz-jason zz-jason left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

}
f64s := result.Float64s()
for i := 0; i < len(f64s); i++ {
f64s[i] = math.Abs(f64s[i])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it be faster if we only calculate the non NULL values?

Copy link
Contributor Author

@tsthght tsthght Sep 23, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when only calculate the non NULL values, like that:
if result.IsNull(i) {
continue
}
BenchmarkVectorizedBuiltinMathFunc/builtinAbsRealSig-VecBuiltinFunc-8 500000 3210 ns/op 0 B/op 0 allocs/op

when calculate all values,
BenchmarkVectorizedBuiltinMathFunc/builtinAbsRealSig-VecBuiltinFunc-8 2000000 956 ns/op 0 B/op 0 allocs/op

so, calculate all values is falster.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it

@zz-jason zz-jason added the status/LGT1 Indicates that a PR has LGTM 1. label Sep 23, 2019
Copy link
Contributor

@Reminiscent Reminiscent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Reminiscent Reminiscent added status/LGT2 Indicates that a PR has LGTM 2. status/can-merge Indicates a PR has been approved by a committer. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Sep 23, 2019
@sre-bot
Copy link
Contributor

sre-bot commented Sep 23, 2019

Your auto merge job has been accepted, waiting for 12298

@sre-bot
Copy link
Contributor

sre-bot commented Sep 23, 2019

/run-all-tests

@sre-bot sre-bot merged commit 14df525 into pingcap:master Sep 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/expression contribution This PR is from a community contributor. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants