commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebb (JIRA)" <>
Subject [jira] [Commented] (COMPRESS-233) Microbenchmarking TarBuffer#isEOFRecord
Date Mon, 08 Jul 2013 15:31:49 GMT


Sebb commented on COMPRESS-233:

bq. the if-statement inside the loop will perform a bounds check on each access to record,
this may be costly

Arrays.equals has to do the same check against 2 arrays unless the compiler can somehow work
out that the index will never go out of bounds.

If that is the case, then maybe there is a way to hint to the compiler that this is true in

bq. - and Arrays.equals has several ways to get optimized by the compiler/runtime.

I suppose it is more likely to be used, but otherwise the loops are very similar.
> Microbenchmarking TarBuffer#isEOFRecord
> ---------------------------------------
>                 Key: COMPRESS-233
>                 URL:
>             Project: Commons Compress
>          Issue Type: Improvement
>            Reporter: BELUGA BEHR
>            Priority: Minor
>             Fix For: 1.6
>         Attachments:
> 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

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:

View raw message