[ https://issues.apache.org/jira/browse/HADOOP-9601?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13705051#comment-13705051 ]
Colin Patrick McCabe commented on HADOOP-9601: ---------------------------------------------- I still think this can be done without macros. The easiest way is to combine the loop body with the "remainder" body. You probably want something like a while (1) and then some if statements to handle the value of i. If done carefully, it will not be slower. And it will be much, much, more readable. There is another problem here, which is that you are assuming that you can load a uint32_t from an unaligned address (i.e., not a multiple of 4). There is information about alignment here: http://lwn.net/Articles/260832/ Although this works on x86, this will fail on ARM, and a lot of other architectures. This may be something that needs to be opened as a separate bug, though, since I think other users of {{bulk_verify_crc}} are also doing this. > Support native CRC on byte arrays > --------------------------------- > > Key: HADOOP-9601 > URL: https://issues.apache.org/jira/browse/HADOOP-9601 > Project: Hadoop Common > Issue Type: Improvement > Components: performance, util > Affects Versions: 3.0.0 > Reporter: Todd Lipcon > Assignee: Gopal V > Labels: perfomance > Attachments: HADOOP-9601-bench.patch, > HADOOP-9601-rebase+benchmark.patch, HADOOP-9601-trunk-rebase-2.patch, > HADOOP-9601-trunk-rebase.patch, HADOOP-9601-WIP-01.patch, > HADOOP-9601-WIP-02.patch > > > When we first implemented the Native CRC code, we only did so for direct byte > buffers, because these correspond directly to native heap memory and thus > make it easy to access via JNI. We'd generally assumed that accessing byte[] > arrays from JNI was not efficient enough, but now that I know more about JNI > I don't think that's true -- we just need to make sure that the critical > sections where we lock the buffers are short. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira