Closed 4ndyc closed 4 years ago
Wow that's great insight. I will check this in tonight!
On May 16, 2017 15:33, "4ndyc" notifications@github.com wrote:
Performance of the ViewNavigatorEntryIterator can be boosted by around 20% - 30% compared to the existing implementation by altering it to use ViewNavigator.getNext() rather than ViewNavigator.getNext(ViewEntry) - see http://linqed.eu/2017/05/12/convenience-at-a-cost- comparing-domino-java-apis-performance-oda-legacy-jna/ http://url. I've tested the following implementation, comments etc excluded for brevity:
public class ViewNavigatorEntryIterator implements Iterator
{ private transient ViewNavigator navigator; private transient ViewEntry currentEntry; private transient ViewEntry nextEntry_;
public ViewNavigatorEntryIterator(ViewNavigator navigator) { navigator = navigator; nextEntry = navigator_.getFirst(); }
public boolean hasNext() { return nextEntry_ != null; }
public ViewEntry next() { if (hasNext()) { currentEntry = nextEntry; nextEntry = navigator.getNext(); return currentEntry_; } else { return null; } }
public void remove() { // Not implemented }
}
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/OpenNTF/org.openntf.domino/issues/161, or mute the thread https://github.com/notifications/unsubscribe-auth/ACoex9_vRFnJoYMUAxrOiZkmchgZw0Gqks5r6gfjgaJpZM4NdCsn .
Although the results still stand, on further investigation ViewNavigator.getNext(ViewEntry)
doesn't look like the culprit. The actual cause of the problem is the call to hasNext
in the iterator's next
method, which increases the number of API calls.
Performance of the
ViewNavigatorEntryIterator
can be boosted by around 20% - 30% compared to the existing implementation by altering it to useViewNavigator.getNext()
rather thanViewNavigator.getNext(ViewEntry)
- see http://linqed.eu/2017/05/12/convenience-at-a-cost-comparing-domino-java-apis-performance-oda-legacy-jna/. I've tested the following implementation, comments etc excluded for brevity: