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

Tsz Wo (Nicholas), SZE updated HADOOP-6148:
-------------------------------------------

    Attachment: PureJavaCrc32.java

I think the codes could be improved a little bit as following.
{code}
    public void update(byte[] b, int off, final int len) {
      for(final int end = off + (len & ~3); off < end; ) {
        final int c0 = crc ^ b[off++];
        final int c1 = (crc >>>= 8) ^ b[off++];
        final int c2 = (crc >>>= 8) ^ b[off++];
        final int c3 = (crc >>>= 8) ^ b[off++];
        crc = T4[c0 & 0xff] ^ T3[c1 & 0xff] ^ T2[c2 & 0xff] ^ T1[c3 & 0xff];
      }
      
      for(final int end = off + (len & 3); off < end; ) {
        crc = (crc >>> 8) ^ T1[(crc ^ b[off++]) & 0xff];
      }
    }
{code}
PureJavaCrc32.java: I moved the codes around and did some benchmarks.

> Implement a pure Java CRC32 calculator
> --------------------------------------
>
>                 Key: HADOOP-6148
>                 URL: https://issues.apache.org/jira/browse/HADOOP-6148
>             Project: Hadoop Common
>          Issue Type: Improvement
>            Reporter: Owen O'Malley
>            Assignee: Todd Lipcon
>         Attachments: benchmarks20090714.txt, crc32-results.txt, 
> hadoop-5598-evil.txt, hadoop-5598-hybrid.txt, hadoop-5598.txt, 
> hadoop-5598.txt, hdfs-297.txt, PureJavaCrc32.java, PureJavaCrc32.java, 
> PureJavaCrc32.java, PureJavaCrc32.java, TestCrc32Performance.java, 
> TestCrc32Performance.java, TestCrc32Performance.java, TestPureJavaCrc32.java
>
>
> We've seen a reducer writing 200MB to HDFS with replication = 1 spending a 
> long time in crc calculation. In particular, it was spending 5 seconds in crc 
> calculation out of a total of 6 for the write. I suspect that it is the 
> java-jni border that is causing us grief.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to