Skip to content

expression: implement vectorized evaluation for builtinLog10Sig#12012

Merged
sre-bot merged 6 commits intopingcap:masterfrom
qw4990:vecexpr-log10
Sep 4, 2019
Merged

expression: implement vectorized evaluation for builtinLog10Sig#12012
sre-bot merged 6 commits intopingcap:masterfrom
qw4990:vecexpr-log10

Conversation

@qw4990
Copy link
Contributor

@qw4990 qw4990 commented Sep 3, 2019

What problem does this PR solve?

Implement vectorized evaluation for builtinLog10Sig

What is changed and how it works?

Here is the benchmark, almost 2.5x fater than before:

BenchmarkVectorizedBuiltinFunc/builtinLog10Sig-VecBuiltinFunc-12                          200000              8148 ns/op
BenchmarkVectorizedBuiltinFunc/builtinLog10Sig-NonVecBuiltinFunc-12                       100000             20654 ns/op

Check List

Tests

  • Unit test

@qw4990
Copy link
Contributor Author

qw4990 commented Sep 3, 2019

/run-all-tests

@qw4990
Copy link
Contributor Author

qw4990 commented Sep 3, 2019

/run-unit-test

@codecov
Copy link

codecov bot commented Sep 3, 2019

Codecov Report

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

@@             Coverage Diff             @@
##             master     #12012   +/-   ##
===========================================
  Coverage   81.3707%   81.3707%           
===========================================
  Files           446        446           
  Lines         95597      95597           
===========================================
  Hits          77788      77788           
  Misses        12284      12284           
  Partials       5525       5525

@@ -0,0 +1,46 @@
// Copyright 2013 The ql Authors. All rights reserved.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// Copyright 2013 The ql Authors. All rights reserved.
// Copyright 2019 The ql Authors. All rights reserved.

Copy link
Contributor

Choose a reason for hiding this comment

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

Unnecessary to state ql license here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it's my mistake.
It's updated now.

}
f64s := result.Float64s()
for i := 0; i < len(f64s); i++ {
if result.IsNull(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 don't check null here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

After testing, this way is slightly faster.
I think the reason is that math.Log10 is relatively heavy to SetNull, so it's better to check nulls here.

Copy link
Contributor

@XuHuaiyu XuHuaiyu left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@SunRunAway SunRunAway left a comment

Choose a reason for hiding this comment

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

LGTM

@qw4990 qw4990 added the status/can-merge Indicates a PR has been approved by a committer. label Sep 4, 2019
@sre-bot
Copy link
Contributor

sre-bot commented Sep 4, 2019

/run-all-tests

@zz-jason
Copy link
Member

zz-jason commented Sep 9, 2019

to #12058

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/expression status/can-merge Indicates a PR has been approved by a committer.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants