Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-7115

Speed up FieldCache.CacheEntry toString by setting initial StringBuilder capacity

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • trunk, 6.1
    • core/search
    • None
    • New

    Description

      Solr can end up printing a lot of these objects via the JmxMonitoriedMap, see SOLR-8869 and SOLR-6747 as examples.

      From looking at some profiles, a lot of time and memory are spent resizing the StringBuilder, which doesn't set the initial capacity.

      On my cluster, the strings are a bit over 200 chars; I set the initial capacity to 250 and ran tests calling toString 1000 times. Tests consistently show 10-15% improvement when setting the initial capacity.

      Attachments

        1. LUCENE-7115.patch
          0.7 kB
          Gregory Chanan

        Activity

          People

            gchanan Gregory Chanan
            gchanan Gregory Chanan
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: