We're updating the issue view to help you get more done. 

Reduce amount of objects created by the FacetCollector

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:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 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:

Environment

None

Status

Assignee

Sanne Grinovero

Reporter

adamb

Labels

Suitable for new contributors

None

Pull Request

None

Feedback Requested

None

Components

Fix versions

Affects versions

4.4.2.Final

Priority

Major