every time we count facets on DocValues fields in Solr on many segments index we see the unnecessary hotspot:
the reason is SlowCompositeReaderWrapper.getSortedSetDocValues() Line 136 and SlowCompositeReaderWrapper.getSortedDocValues() Line 174
before return composite doc values, SCWR merges segment field infos, which is expensive, but after fieldinfo is merged, it checks only docvalue type in it. This dv type check can be done much easier in per segment basis.
This patch gets some performance gain for those who count DV facets in Solr.