Details
-
Type: Improvement
-
Status: Closed (View Workflow)
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 0.9.9
-
Fix Version/s: 1.0.0
-
Component/s: o.c.jsword.passage
-
Labels:None
Description
The KeySidebar uses a list model that is backed by an AbstractPassage.
One of the most frequent operations of a list model is to call getElementAt(int index).
In the case of an AbstractPassage, this calls getRangeAt.
This creates a VerseRangeIterator and iterates until it reaches the requested index and then returns the range.
The VerseRangeIterator builds itself from an iterator over all the verses.
The problem is that this sequence of events happens for each element in the list. When getting the 100th element in the list, it has previously created 100 iterators and this time loops 100 times to get the result.
One solution would be for the list model to get the list of ranges once each time the passage changes.