Lucene - Core
  1. Lucene - Core
  2. LUCENE-6827

Use explicit capacity ArrayList instead of a LinkedList in MultiFieldQueryNodeProcessor

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Trivial Trivial
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.4, 6.0
    • Component/s: None
    • Labels:
      None
    • Lucene Fields:
      New

      Activity

      Hide
      Dawid Weiss added a comment -

      Patch. Also piggybacks new RuntimeException() if clone fails (should never happen means it probably will at some point – we shouldn't ignore that quietly).

      Show
      Dawid Weiss added a comment - Patch. Also piggybacks new RuntimeException() if clone fails (should never happen means it probably will at some point – we shouldn't ignore that quietly).
      Hide
      Adrien Grand added a comment -

      +1

      Show
      Adrien Grand added a comment - +1
      Hide
      Uwe Schindler added a comment -

      Indeed, we should review all usages of LinkedList throughout Lucene/Solr. It is not clear why it was used here, but some places used it in pre Java 6 times to allow fast removal and addition of entries at beginning (typical LIFO/FIFO usage).

      Since Java 6 the much better data structure for this is java.util.Deque (which LinkedList implements), but using ArrayDeque as implementation is much more heap/performance efficient.

      Show
      Uwe Schindler added a comment - Indeed, we should review all usages of LinkedList throughout Lucene/Solr. It is not clear why it was used here, but some places used it in pre Java 6 times to allow fast removal and addition of entries at beginning (typical LIFO/FIFO usage). Since Java 6 the much better data structure for this is java.util.Deque (which LinkedList implements), but using ArrayDeque as implementation is much more heap/performance efficient.
      Hide
      Dawid Weiss added a comment -

      In fact I thought about that too – if somebody uses LinkedList (or Hashtable or a Vector... any of these) then it's probably an ancient artefact and very likely a mistake and/or could be replaced with a faster implementation.

      You should add these to forbidden APIs, Uwe

      Show
      Dawid Weiss added a comment - In fact I thought about that too – if somebody uses LinkedList (or Hashtable or a Vector... any of these) then it's probably an ancient artefact and very likely a mistake and/or could be replaced with a faster implementation. You should add these to forbidden APIs, Uwe
      Hide
      ASF subversion and git services added a comment -

      Commit 1707040 from Dawid Weiss in branch 'dev/trunk'
      [ https://svn.apache.org/r1707040 ]

      LUCENE-6827: Use explicit capacity ArrayList instead of a LinkedList in MultiFieldQueryNodeProcessor

      Show
      ASF subversion and git services added a comment - Commit 1707040 from Dawid Weiss in branch 'dev/trunk' [ https://svn.apache.org/r1707040 ] LUCENE-6827 : Use explicit capacity ArrayList instead of a LinkedList in MultiFieldQueryNodeProcessor
      Hide
      ASF subversion and git services added a comment -

      Commit 1707041 from Dawid Weiss in branch 'dev/branches/branch_5x'
      [ https://svn.apache.org/r1707041 ]

      LUCENE-6827: Use explicit capacity ArrayList instead of a LinkedList in MultiFieldQueryNodeProcessor

      Show
      ASF subversion and git services added a comment - Commit 1707041 from Dawid Weiss in branch 'dev/branches/branch_5x' [ https://svn.apache.org/r1707041 ] LUCENE-6827 : Use explicit capacity ArrayList instead of a LinkedList in MultiFieldQueryNodeProcessor

        People

        • Assignee:
          Dawid Weiss
          Reporter:
          Dawid Weiss
        • Votes:
          0 Vote for this issue
          Watchers:
          3 Start watching this issue

          Dates

          • Created:
            Updated:
            Resolved:

            Development