Uploaded image for project: 'Hibernate Search'
  1. HSEARCH-1468

Reduce amount of objects created by the FacetCollector

    Details

      Description

      We've recently been profiling our application using YourKit and noticed that a tremendous number of objects are being created and subsequently destroyed by the FacetCollector because it's collecting Integer objects in its map. At this point, the faceting component of HibernateSearch appears to take the most time of anything else in the entire action.

      While the JVM is clearly better in the management of these temporary objects, the trivial nature of this operation over-time may likely add up to something non-trivial when counting. An alternate approach might be to use a wrapper class for an integer that only gets instantiated once:

      	public class IntegerWrapper {
      	    int count = 0;
      	    
      	    public int getCount() {
      	        return count;
      	    }
      	    
      	    public void setCount(int count) {
      	        this.count = count;
      	    }
      	    
      	    public void incrementCount() {
      	        this.count++;
      	    }
      	}
      

      useful references:

        Attachments

          Activity

            People

            • Assignee:
              sanne Sanne Grinovero
              Reporter:
              abrin abrin
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: