You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Jacob Graves (JIRA)" <ji...@apache.org> on 2015/06/01 21:46:18 UTC

[jira] [Created] (SOLR-7618) MultiFunction.anyExists - creating FunctionValues[] objects for every document

Jacob Graves created SOLR-7618:
----------------------------------

             Summary: MultiFunction.anyExists - creating FunctionValues[] objects for every document
                 Key: SOLR-7618
                 URL: https://issues.apache.org/jira/browse/SOLR-7618
             Project: Solr
          Issue Type: Bug
          Components: SearchComponents - other
    Affects Versions: 5.1
            Reporter: Jacob Graves
            Priority: Minor
             Fix For: 5.1


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.





--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


RE: [jira] [Created] (SOLR-7618) MultiFunction.anyExists - creating FunctionValues[] objects for every document

Posted by Jacob Graves <ja...@gettyimages.com>.
Hello

I just logged this Jira for a bug I tracked down in SOLR 5.1.

My proposed fix is just to get rid of the "..." syntactic sugar and replace it with 2 overloaded methods that will take in either an array or 2 single objects and do the same comparison.
I will also fix the related method anyExists which has the same problem.

It’s a simple fix and I have already created and tested a patch on our SOLR cluster.

I was going to check it in to the branch_5x if I get the go ahead.

Let me know.

Thanks - Jake

PS - newbie

-----Original Message-----
From: Jacob Graves (JIRA) [mailto:jira@apache.org] 
Sent: Monday, June 01, 2015 12:46 PM
To: dev@lucene.apache.org
Subject: [jira] [Created] (SOLR-7618) MultiFunction.anyExists - creating FunctionValues[] objects for every document

Jacob Graves created SOLR-7618:
----------------------------------

             Summary: MultiFunction.anyExists - creating FunctionValues[] objects for every document
                 Key: SOLR-7618
                 URL: https://issues.apache.org/jira/browse/SOLR-7618
             Project: Solr
          Issue Type: Bug
          Components: SearchComponents - other
    Affects Versions: 5.1
            Reporter: Jacob Graves
            Priority: Minor
             Fix For: 5.1


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.





--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org For additional commands, e-mail: dev-help@lucene.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org