You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@kudu.apache.org by "Todd Lipcon (Code Review)" <ge...@cloudera.org> on 2017/11/01 20:02:58 UTC

[kudu-CR] compaction policy: avoid a division in approximation algorithm

Hello zhen.zhang, Adar Dembo,

I'd like you to do a code review. Please visit

    http://gerrit.cloudera.org:8080/8445

to review the following change.


Change subject: compaction_policy: avoid a division in approximation algorithm
......................................................................

compaction_policy: avoid a division in approximation algorithm

This does some simple mathematical substitution to avoid an unnecessary
division instruction in the approximation algorithm in the compaction
policy. This provided a ~5% speedup:

Before:

 Performance counter stats for 'build/latest/bin/compaction_policy-test --gtest_filter=*TinyOver*' (10 runs):

        426.861117      task-clock (msec)         #    0.999 CPUs utilized            ( +-  0.87% )
                 2      context-switches          #    0.004 K/sec                    ( +- 23.13% )
                 0      cpu-migrations            #    0.000 K/sec
             2,476      page-faults               #    0.006 M/sec                    ( +-  4.38% )
     1,597,139,052      cycles                    #    3.742 GHz                      ( +-  0.67% )
     4,013,990,056      instructions              #    2.51  insn per cycle           ( +-  0.01% )
       628,035,462      branches                  # 1471.288 M/sec                    ( +-  0.01% )
         2,408,063      branch-misses             #    0.38% of all branches          ( +-  0.13% )

       0.427287921 seconds time elapsed                                          ( +-  0.86% )

After:

 Performance counter stats for 'build/latest/bin/compaction_policy-test --gtest_filter=*TinyOver*' (10 runs):

        404.664720      task-clock (msec)         #    0.999 CPUs utilized            ( +-  0.93% )
                 1      context-switches          #    0.003 K/sec                    ( +- 28.21% )
                 0      cpu-migrations            #    0.000 K/sec
             2,531      page-faults               #    0.006 M/sec                    ( +-  3.54% )
     1,508,535,824      cycles                    #    3.728 GHz                      ( +-  0.22% )
     3,916,607,007      instructions              #    2.60  insn per cycle           ( +-  0.01% )
       628,048,996      branches                  # 1552.023 M/sec                    ( +-  0.01% )
         2,380,872      branch-misses             #    0.38% of all branches          ( +-  0.08% )

       0.404947434 seconds time elapsed                                          ( +-  0.94% )

Change-Id: I018a81987744c35ff672765ac9e212fd3654638d
---
M src/kudu/tablet/compaction_policy.cc
1 file changed, 13 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/45/8445/1
-- 
To view, visit http://gerrit.cloudera.org:8080/8445
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I018a81987744c35ff672765ac9e212fd3654638d
Gerrit-Change-Number: 8445
Gerrit-PatchSet: 1
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: zhen.zhang <zh...@xiaomi.com>

[kudu-CR] compaction policy: avoid a division in approximation algorithm

Posted by "Todd Lipcon (Code Review)" <ge...@cloudera.org>.
Todd Lipcon has posted comments on this change. ( http://gerrit.cloudera.org:8080/8445 )

Change subject: compaction_policy: avoid a division in approximation algorithm
......................................................................


Patch Set 2: Code-Review+2

Carrying +2


-- 
To view, visit http://gerrit.cloudera.org:8080/8445
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I018a81987744c35ff672765ac9e212fd3654638d
Gerrit-Change-Number: 8445
Gerrit-PatchSet: 2
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: zhen.zhang <zh...@xiaomi.com>
Gerrit-Comment-Date: Wed, 01 Nov 2017 23:17:35 +0000
Gerrit-HasComments: No

[kudu-CR] compaction policy: avoid a division in approximation algorithm

Posted by "Todd Lipcon (Code Review)" <ge...@cloudera.org>.
Todd Lipcon has posted comments on this change. ( http://gerrit.cloudera.org:8080/8445 )

Change subject: compaction_policy: avoid a division in approximation algorithm
......................................................................


Patch Set 2: Verified+1

Test failure was a spurious one due to EINTR handling (filed a JIRA)


-- 
To view, visit http://gerrit.cloudera.org:8080/8445
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I018a81987744c35ff672765ac9e212fd3654638d
Gerrit-Change-Number: 8445
Gerrit-PatchSet: 2
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: zhen.zhang <zh...@xiaomi.com>
Gerrit-Comment-Date: Wed, 01 Nov 2017 22:55:14 +0000
Gerrit-HasComments: No

[kudu-CR] compaction policy: avoid a division in approximation algorithm

Posted by "Todd Lipcon (Code Review)" <ge...@cloudera.org>.
Todd Lipcon has removed Kudu Jenkins from this change.  ( http://gerrit.cloudera.org:8080/8445 )

Change subject: compaction_policy: avoid a division in approximation algorithm
......................................................................


Removed reviewer Kudu Jenkins with the following votes:

* Verified-1 by Kudu Jenkins (120)
-- 
To view, visit http://gerrit.cloudera.org:8080/8445
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: deleteReviewer
Gerrit-Change-Id: I018a81987744c35ff672765ac9e212fd3654638d
Gerrit-Change-Number: 8445
Gerrit-PatchSet: 2
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: zhen.zhang <zh...@xiaomi.com>

[kudu-CR] compaction policy: avoid a division in approximation algorithm

Posted by "Todd Lipcon (Code Review)" <ge...@cloudera.org>.
Todd Lipcon has submitted this change and it was merged. ( http://gerrit.cloudera.org:8080/8445 )

Change subject: compaction_policy: avoid a division in approximation algorithm
......................................................................

compaction_policy: avoid a division in approximation algorithm

This does some simple mathematical substitution to avoid an unnecessary
division instruction in the approximation algorithm in the compaction
policy. This provided a ~5% speedup:

Before:

 Performance counter stats for 'build/latest/bin/compaction_policy-test --gtest_filter=*TinyOver*' (10 runs):

        426.861117      task-clock (msec)         #    0.999 CPUs utilized            ( +-  0.87% )
                 2      context-switches          #    0.004 K/sec                    ( +- 23.13% )
                 0      cpu-migrations            #    0.000 K/sec
             2,476      page-faults               #    0.006 M/sec                    ( +-  4.38% )
     1,597,139,052      cycles                    #    3.742 GHz                      ( +-  0.67% )
     4,013,990,056      instructions              #    2.51  insn per cycle           ( +-  0.01% )
       628,035,462      branches                  # 1471.288 M/sec                    ( +-  0.01% )
         2,408,063      branch-misses             #    0.38% of all branches          ( +-  0.13% )

       0.427287921 seconds time elapsed                                          ( +-  0.86% )

After:

 Performance counter stats for 'build/latest/bin/compaction_policy-test --gtest_filter=*TinyOver*' (10 runs):

        404.664720      task-clock (msec)         #    0.999 CPUs utilized            ( +-  0.93% )
                 1      context-switches          #    0.003 K/sec                    ( +- 28.21% )
                 0      cpu-migrations            #    0.000 K/sec
             2,531      page-faults               #    0.006 M/sec                    ( +-  3.54% )
     1,508,535,824      cycles                    #    3.728 GHz                      ( +-  0.22% )
     3,916,607,007      instructions              #    2.60  insn per cycle           ( +-  0.01% )
       628,048,996      branches                  # 1552.023 M/sec                    ( +-  0.01% )
         2,380,872      branch-misses             #    0.38% of all branches          ( +-  0.08% )

       0.404947434 seconds time elapsed                                          ( +-  0.94% )

Change-Id: I018a81987744c35ff672765ac9e212fd3654638d
Reviewed-on: http://gerrit.cloudera.org:8080/8445
Tested-by: Todd Lipcon <to...@apache.org>
Reviewed-by: Todd Lipcon <to...@apache.org>
---
M src/kudu/tablet/compaction_policy.cc
1 file changed, 13 insertions(+), 3 deletions(-)

Approvals:
  Todd Lipcon: Looks good to me, approved; Verified

-- 
To view, visit http://gerrit.cloudera.org:8080/8445
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I018a81987744c35ff672765ac9e212fd3654638d
Gerrit-Change-Number: 8445
Gerrit-PatchSet: 3
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: zhen.zhang <zh...@xiaomi.com>

[kudu-CR] compaction policy: avoid a division in approximation algorithm

Posted by "Adar Dembo (Code Review)" <ge...@cloudera.org>.
Adar Dembo has posted comments on this change. ( http://gerrit.cloudera.org:8080/8445 )

Change subject: compaction_policy: avoid a division in approximation algorithm
......................................................................


Patch Set 1: Code-Review+2


-- 
To view, visit http://gerrit.cloudera.org:8080/8445
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I018a81987744c35ff672765ac9e212fd3654638d
Gerrit-Change-Number: 8445
Gerrit-PatchSet: 1
Gerrit-Owner: Todd Lipcon <to...@apache.org>
Gerrit-Reviewer: Adar Dembo <ad...@cloudera.com>
Gerrit-Reviewer: Kudu Jenkins
Gerrit-Reviewer: zhen.zhang <zh...@xiaomi.com>
Gerrit-Comment-Date: Wed, 01 Nov 2017 20:50:06 +0000
Gerrit-HasComments: No