Uploaded image for project: 'JSword'
  1. JSword
  2. JS-54

Optimize large search results (AbstractPassage.getRangeAt)

    Details

      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.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              dmsmith DM Smith
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: