Sanne: Sure, please open a JIRA and add a patch. You'll need to create a user ID on the JIRA system, but that's a "self-serve" option.
Best, Erick On Mon, Nov 23, 2015 at 8:21 AM, Sanne Grinovero <[email protected]> wrote: > Hello all, > I was looking into the source code for > org.apache.lucene.facet.FacetsConfig as it's being highlighted as an > hotspot of allocations during a performance analysis session. > > Our code was allocating a new instance of FacetsConfig for each > Document being built; there are several maps being allocated by such > an instance, both as instance fields and on the hot path of method > "#build(Document doc)". > > My understanding from reading the code is that it's designed to be > multi-threaded, probably to reuse one instance for a single index? > > That would resolve my issue with allocations at instance level, and > probably also the maps being allocated within the build method as the > JVM seems to be smart enough to skip those; at least that's my > impression with a quick experiment. > > However reusing this single instance across all threads would become a > contention point as all getters to read the field configurations are > synchronized. > Since the maps being read are actually safe ConcurrentMap instances, I > see no reason for the "synchronized", so really it just boils down to > a trivial patch to remove those on the reader methods. > > May I open a JIRA and propose a patch for that? > > As a second step, I'd also like to see if the build method could be > short-circuited for a quick return: in case there are no faceted > fields would be great to just return with the input document right > away. > > Thanks, > Sanne > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
