mirror of https://github.com/apache/lucene.git
SOLR-12882: Eliminate excessive lambda allocation in json facet FacetFieldProcessorByHashDV.collectValFirstPhase
This commit is contained in:
parent
05f72a77ef
commit
cf445ba549
|
@ -252,6 +252,8 @@ Improvements
|
|||
|
||||
* SOLR-12892: MapWriter to use CharSequence instead of String (noble)
|
||||
|
||||
* SOLR-12882: Eliminate excessive lambda allocation in json facets FacetFieldProcessorByHashDV (Tim Underwood)
|
||||
|
||||
================== 7.5.0 ==================
|
||||
|
||||
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.
|
||||
|
|
|
@ -430,12 +430,20 @@ class FacetFieldProcessorByHashDV extends FacetFieldProcessor {
|
|||
// Our countAcc is virtual, so this is not needed:
|
||||
// countAcc.incrementCount(slot, 1);
|
||||
|
||||
super.collectFirstPhase(segDoc, slot, slotNum -> {
|
||||
Comparable value = calc.bitsToValue(val);
|
||||
return new SlotContext(sf.getType().getFieldQuery(null, sf, calc.formatValue(value)));
|
||||
});
|
||||
super.collectFirstPhase(segDoc, slot, slotContext);
|
||||
}
|
||||
|
||||
/**
|
||||
* SlotContext to use during all {@link SlotAcc} collection.
|
||||
*
|
||||
* This avoids a memory allocation for each invocation of collectValFirstPhase.
|
||||
*/
|
||||
private IntFunction<SlotContext> slotContext = (slotNum) -> {
|
||||
long val = table.vals[slotNum];
|
||||
Comparable value = calc.bitsToValue(val);
|
||||
return new SlotContext(sf.getType().getFieldQuery(null, sf, calc.formatValue(value)));
|
||||
};
|
||||
|
||||
private void doRehash(LongCounts table) {
|
||||
if (collectAcc == null && allBucketsAcc == null) return;
|
||||
|
||||
|
|
Loading…
Reference in New Issue