Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-6569

MultiFunction.anyExists - creating FunctionValues[] objects for every document

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 5.3, 6.0
    • None
    • New

    Description

      In the class org.apache.lucene.queries.function.valuesource.MultiFunction there is the following method signature (line 52)

      public static boolean allExists(int doc, FunctionValues... values)

      this method is called from the class org.apache.lucene.queries.function.valuesource.DualFloatFunction (line 68)

      public boolean exists(int doc)

      { return MultiFunction.allExists(doc, aVals, bVals); }

      Because MultiFunction.allExists uses Java varargs syntax ("...") a new FunctionValues[] object will be created every time this call takes place.

      The problem is that the call takes place in a document level function, which means that it will create new objects in the heap for every document in the query results.

      for example if you use the following boost function (where ds and dc1 are both TrieDateField)

      bf=min(ms(ds,dc1),604800000)

      You will get extra objects created for each document in the result set, which has a big impact on performance and memory usage if you are searching a large result set.

      Attachments

        1. SOLR-7618.patch
          7 kB
          Chris M. Hostetter
        2. SOLR-7618.patch
          3 kB
          Jacob Graves

        Activity

          People

            hossman Chris M. Hostetter
            EqualToJake Jacob Graves
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 2h
                2h
                Remaining:
                Remaining Estimate - 2h
                2h
                Logged:
                Time Spent - Not Specified
                Not Specified