commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "BELUGA BEHR (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (COMPRESS-233) Microbenchmarking TarBuffer#isEOFRecord
Date Mon, 08 Jul 2013 12:09:50 GMT

    [ https://issues.apache.org/jira/browse/COMPRESS-233?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13701960#comment-13701960
] 

BELUGA BEHR commented on COMPRESS-233:
--------------------------------------

Sebb,

Thanks for the feedback.  I'll investigate further.  I updated the patch to make it even more
simple.  The Arrays.equals() does null checking already, so I removed that.

My test did not take into the account of creating the initial array.  That is a one-time cost
though v.s. navigating the entries each time.  I'll look at the effects of that.

As far as assuming the initial array is all zeros, it's in the Java Spec.

{code}
Each class variable, instance variable, or array component is initialized with a default value
when it is created (§15.9, §15.10):

For type byte, the default value is zero, that is, the value of (byte)0.

For type short, the default value is zero, that is, the value of (short)0.

For type int, the default value is zero, that is, 0.

For type long, the default value is zero, that is, 0L.

For type float, the default value is positive zero, that is, 0.0f.

For type double, the default value is positive zero, that is, 0.0d.

For type char, the default value is the null character, that is, '\u0000'.

For type boolean, the default value is false.

For all reference types (§4.3), the default value is null.
{code}
                
> Microbenchmarking TarBuffer#isEOFRecord
> ---------------------------------------
>
>                 Key: COMPRESS-233
>                 URL: https://issues.apache.org/jira/browse/COMPRESS-233
>             Project: Commons Compress
>          Issue Type: Improvement
>            Reporter: BELUGA BEHR
>            Priority: Minor
>         Attachments: TarBuffer.java.patch
>
>
> It's possible to speed up the regular checking of isEOFRecord by creating a buffer that
is all zeros then using the Java primitive Arrays.equals function.  My bench-marking puts
it at roughly 1/3 the time per check.  No unit tests were harmed in the production of these
modifications.

--
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

Mime
View raw message