[jira] [Commented] (HBASE-4206) jenkins hash implementation uses longs unnecessarily

2011-09-02 Thread Ron Yang (JIRA)

[ 
https://issues.apache.org/jira/browse/HBASE-4206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13096302#comment-13096302
 ] 

Ron Yang commented on HBASE-4206:
-

I wrote a data generator and did before/after hash comparisons.  I also wrote a 
test to verify that signed int arithmetic behaves the same as long arithmetic 
truncated to int.  The new code has been running in production here for a few 
weeks and behaving satisfactorily, although in a non-mission-critical capacity.

 jenkins hash implementation uses longs unnecessarily
 

 Key: HBASE-4206
 URL: https://issues.apache.org/jira/browse/HBASE-4206
 Project: HBase
  Issue Type: Improvement
  Components: util
Affects Versions: 0.90.4
Reporter: Ron Yang
Priority: Minor
 Fix For: 0.92.0, 0.90.5

 Attachments: ryang.patch


 I don't believe you need to use long for a,b,c and as a result no longer need 
 to  against INT_MASK.
 At a minimum the private static longs should be made final, and the main 
 method should not print the absolute value of the hash but instead use 
 something like Integer.toHexString

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Updated] (HBASE-4206) jenkins hash implementation uses longs unnecessarily

2011-09-02 Thread Ron Yang (JIRA)

 [ 
https://issues.apache.org/jira/browse/HBASE-4206?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ron Yang updated HBASE-4206:


Attachment: JenkinsHashTest.tgz

eclipse project with my tests that try to verify the changes didn't regress 
JenkinsHash

 jenkins hash implementation uses longs unnecessarily
 

 Key: HBASE-4206
 URL: https://issues.apache.org/jira/browse/HBASE-4206
 Project: HBase
  Issue Type: Improvement
  Components: util
Affects Versions: 0.90.4
Reporter: Ron Yang
Assignee: Ron Yang
Priority: Minor
 Fix For: 0.92.0, 0.90.5

 Attachments: JenkinsHashTest.tgz, ryang.patch


 I don't believe you need to use long for a,b,c and as a result no longer need 
 to  against INT_MASK.
 At a minimum the private static longs should be made final, and the main 
 method should not print the absolute value of the hash but instead use 
 something like Integer.toHexString

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Commented] (HBASE-4206) jenkins hash implementation uses longs unnecessarily

2011-09-01 Thread Ron Yang (JIRA)

[ 
https://issues.apache.org/jira/browse/HBASE-4206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13095435#comment-13095435
 ] 

Ron Yang commented on HBASE-4206:
-

any chance this patch will be incorporated?

 jenkins hash implementation uses longs unnecessarily
 

 Key: HBASE-4206
 URL: https://issues.apache.org/jira/browse/HBASE-4206
 Project: HBase
  Issue Type: Improvement
  Components: util
Reporter: Ron Yang
Priority: Minor
 Attachments: ryang.patch


 I don't believe you need to use long for a,b,c and as a result no longer need 
 to  against INT_MASK.
 At a minimum the private static longs should be made final, and the main 
 method should not print the absolute value of the hash but instead use 
 something like Integer.toHexString

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Updated] (HBASE-4206) jenkins hash implementation uses longs unnecessarily

2011-09-01 Thread Ron Yang (JIRA)

 [ 
https://issues.apache.org/jira/browse/HBASE-4206?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ron Yang updated HBASE-4206:


Affects Version/s: 0.90.4
Fix Version/s: 0.90.5
   0.92.0

 jenkins hash implementation uses longs unnecessarily
 

 Key: HBASE-4206
 URL: https://issues.apache.org/jira/browse/HBASE-4206
 Project: HBase
  Issue Type: Improvement
  Components: util
Affects Versions: 0.90.4
Reporter: Ron Yang
Priority: Minor
 Fix For: 0.92.0, 0.90.5

 Attachments: ryang.patch


 I don't believe you need to use long for a,b,c and as a result no longer need 
 to  against INT_MASK.
 At a minimum the private static longs should be made final, and the main 
 method should not print the absolute value of the hash but instead use 
 something like Integer.toHexString

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Updated] (HBASE-4206) jenkins hash implementation uses longs unnecessarily

2011-08-17 Thread Ron Yang (JIRA)

 [ 
https://issues.apache.org/jira/browse/HBASE-4206?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ron Yang updated HBASE-4206:


Status: Patch Available  (was: Open)

 jenkins hash implementation uses longs unnecessarily
 

 Key: HBASE-4206
 URL: https://issues.apache.org/jira/browse/HBASE-4206
 Project: HBase
  Issue Type: Improvement
  Components: util
Reporter: Ron Yang
Priority: Minor

 I don't believe you need to use long for a,b,c and as a result no longer need 
 to  against INT_MASK.
 At a minimum the private static longs should be made final, and the main 
 method should not print the absolute value of the hash but instead use 
 something like Integer.toHexString

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Updated] (HBASE-4206) jenkins hash implementation uses longs unnecessarily

2011-08-17 Thread Ron Yang (JIRA)

 [ 
https://issues.apache.org/jira/browse/HBASE-4206?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ron Yang updated HBASE-4206:


Attachment: ryang.patch

 jenkins hash implementation uses longs unnecessarily
 

 Key: HBASE-4206
 URL: https://issues.apache.org/jira/browse/HBASE-4206
 Project: HBase
  Issue Type: Improvement
  Components: util
Reporter: Ron Yang
Priority: Minor
 Attachments: ryang.patch


 I don't believe you need to use long for a,b,c and as a result no longer need 
 to  against INT_MASK.
 At a minimum the private static longs should be made final, and the main 
 method should not print the absolute value of the hash but instead use 
 something like Integer.toHexString

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Commented] (HBASE-4206) jenkins hash implementation uses longs unnecessarily

2011-08-17 Thread Ron Yang (JIRA)

[ 
https://issues.apache.org/jira/browse/HBASE-4206?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13086526#comment-13086526
 ] 

Ron Yang commented on HBASE-4206:
-

Seems about 35% faster on my MBP core i7 osx 10.6:
java version 1.6.0_26
Java(TM) SE Runtime Environment (build 1.6.0_26-b03-384-10M3425)
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02-384, mixed mode)


 0% Scenario{vm=java, trial=0, benchmark=JenkinsOld, len=5} 29.96 ns; ?=0.45 ns 
@ 10 trials
 6% Scenario{vm=java, trial=0, benchmark=JenkinsNew, len=5} 15.03 ns; ?=0.13 ns 
@ 3 trials
13% Scenario{vm=java, trial=0, benchmark=JenkinsOld, len=10} 32.73 ns; ?=0.06 
ns @ 3 trials
19% Scenario{vm=java, trial=0, benchmark=JenkinsNew, len=10} 17.75 ns; ?=0.04 
ns @ 3 trials
25% Scenario{vm=java, trial=0, benchmark=JenkinsOld, len=15} 55.01 ns; ?=0.20 
ns @ 3 trials
31% Scenario{vm=java, trial=0, benchmark=JenkinsNew, len=15} 26.48 ns; ?=0.26 
ns @ 3 trials
38% Scenario{vm=java, trial=0, benchmark=JenkinsOld, len=20} 59.97 ns; ?=0.17 
ns @ 3 trials
44% Scenario{vm=java, trial=0, benchmark=JenkinsNew, len=20} 29.21 ns; ?=0.12 
ns @ 3 trials
50% Scenario{vm=java, trial=0, benchmark=JenkinsOld, len=500} 1103.94 ns; 
?=5.87 ns @ 3 trials
56% Scenario{vm=java, trial=0, benchmark=JenkinsNew, len=500} 710.87 ns; ?=0.73 
ns @ 3 trials
63% Scenario{vm=java, trial=0, benchmark=JenkinsOld, len=1000} 2206.56 ns; 
?=5.04 ns @ 3 trials
69% Scenario{vm=java, trial=0, benchmark=JenkinsNew, len=1000} 1400.48 ns; 
?=5.44 ns @ 3 trials
75% Scenario{vm=java, trial=0, benchmark=JenkinsOld, len=1} 21632.90 ns; 
?=38.49 ns @ 3 trials
81% Scenario{vm=java, trial=0, benchmark=JenkinsNew, len=1} 13975.43 ns; 
?=65.42 ns @ 3 trials
88% Scenario{vm=java, trial=0, benchmark=JenkinsOld, len=10} 216426.33 ns; 
?=1378.41 ns @ 3 trials
94% Scenario{vm=java, trial=0, benchmark=JenkinsNew, len=10} 139348.44 ns; 
?=594.38 ns @ 3 trials

   len  benchmark   ns linear runtime
 5 JenkinsOld 30.0 =
 5 JenkinsNew 15.0 =
10 JenkinsOld 32.7 =
10 JenkinsNew 17.7 =
15 JenkinsOld 55.0 =
15 JenkinsNew 26.5 =
20 JenkinsOld 60.0 =
20 JenkinsNew 29.2 =
   500 JenkinsOld   1103.9 =
   500 JenkinsNew710.9 =
  1000 JenkinsOld   2206.6 =
  1000 JenkinsNew   1400.5 =
 1 JenkinsOld  21632.9 ==
 1 JenkinsNew  13975.4 =
10 JenkinsOld 216426.3 ==
10 JenkinsNew 139348.4 ===

Caliper benchmark source:
public static class Benchmark6 extends SimpleBenchmark {
@Param({5, 10, 15, 20, 500, 1000, 1, 
10}) int len;
byte[] bs;
@Override protected void setUp() {
Random r = new Random();
bs = new byte[len];
r.nextBytes(bs);
}

public boolean timeJenkinsOld(int reps) {
int h = 0;
for (int x = 0; x  reps; x++) {
h += JenkinsHashOld.hash(bs, h);
}
return true;
}
public boolean timeJenkinsNew(int reps) {
int h = 0;
JenkinsHashNew jh = new JenkinsHashNew();
for (int x = 0; x  reps; x++) {
h += jh.hash(bs, 0, len, h);
}
return true;
}
}

 jenkins hash implementation uses longs unnecessarily
 

 Key: HBASE-4206
 URL: https://issues.apache.org/jira/browse/HBASE-4206
 Project: HBase
  Issue Type: Improvement
  Components: util
Reporter: Ron Yang
Priority: Minor
 Attachments: ryang.patch


 I don't believe you need to use long for a,b,c and as a result no longer need 
 to  against INT_MASK.
 At a minimum the private static longs should be made final, and the main 
 method should not print the absolute value of the hash but instead use 
 something like Integer.toHexString

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Created] (HBASE-4206) jenkins hash implementation uses longs unnecessarily

2011-08-16 Thread Ron Yang (JIRA)
jenkins hash implementation uses longs unnecessarily


 Key: HBASE-4206
 URL: https://issues.apache.org/jira/browse/HBASE-4206
 Project: HBase
  Issue Type: Improvement
  Components: util
Reporter: Ron Yang
Priority: Minor


I don't believe you need to use long for a,b,c and as a result no longer need 
to  against INT_MASK.

At a minimum the private static longs should be made final, and the main 
method should not print the absolute value of the hash but instead use 
something like Integer.toHexString

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira