[
https://issues.apache.org/jira/browse/MATH-627?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13254432#comment-13254432
]
Thomas Neidhart commented on MATH-627:
--------------------------------------
I did some performance tests, and the gain is quite significant: ~50%
Removing the additional null check for the data retrieved from it.next() looks
safe to me, the code would change to something like that (which btw was already
there at some places):
{noformat}
while (it.hasNext()) {
final Entry e = it.next();
...
}
{noformat}
> superfluously null check of SparseIterator.next()
> -------------------------------------------------
>
> Key: MATH-627
> URL: https://issues.apache.org/jira/browse/MATH-627
> Project: Commons Math
> Issue Type: Improvement
> Reporter: Arne Plöse
> Priority: Minor
> Fix For: 3.1
>
>
> Looking at the implementation of SparseIterator in
> OpenMapRealVector.OpenMapSparseIterator there is no chance that the entry
> return by next() is ever null - so there is no need to chek this in nearly
> every loop?
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira