[ http://issues.apache.org/jira/browse/DERBY-2118?page=all ]
Daniel John Debrunner updated DERBY-2118:
-----------------------------------------
Attachment: d2018_clearlimit_cleanup_diff.txt
patch d2018_clearlimit_cleanup_diff.txt
Patch which improves the clearLimit() method by removing the possibility that
the byte array is ever null.
Instead of using null when creating an empty ArrayInputStream an empty array is
used instead.
Remove some unused methods.
Change some callers of the 2-arg setLimit() to the 1-arg setLimit() as it is
more efficient.
Fix a bug where setData() would not reset the position to zero (previously it
was unmodified at a potentially invalid position)
I believe this provides a small improvement (~1%), fixes a bug and does not
change the behaviour of the class.
I have not run any tests on this change.
> Change some boundary checks in ArrayInputStream to ASSERTs to improve
> performance
> ---------------------------------------------------------------------------------
>
> Key: DERBY-2118
> URL: http://issues.apache.org/jira/browse/DERBY-2118
> Project: Derby
> Issue Type: Improvement
> Components: Performance
> Affects Versions: 10.2.1.6
> Reporter: Dyre Tjeldvoll
> Priority: Trivial
> Fix For: 10.3.0.0
>
> Attachments: d2018_clearlimit_cleanup_diff.txt, derby-2118.diff,
> derby-2118.stat, derby-2118.v2.diff
>
>
> Profiling shows that a significant amount of CPU is spent doing boundary
> checking in ArrayInputStream.setPosition() and ArrayInputStream.setLimit().
> These checks appear to be there to detect error conditions, so it seems more
> appropriate to make them ASSERTs. Especially since they are so expensive.
> DTrace analysis seems to confirm that these methods get called very
> frequently:
> Knut Anders Hatlen wrote the following in a message on derby-dev:
> FYI, I just ran the DERBY-1961 test clients and traced them with a
> DTrace script that printed how often each method was called. For the
> join client, ArrayInputStream.setPosition() was the most frequently
> called method (43837.7 calls/tx). For the single-record select client,
> it was third (58.4 calls/tx), only beaten by Object.<init>() and
> DDMWriter.ensureLength(). I think this means that setPosition() is the
> engine method that is most frequently called, at least in read-mostly
> transactions. ArrayInputStream.setLimit() also appeared near the top
> of the list. See http://wiki.apache.org/db-derby/Derby1961MethodCalls
> for the details.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira