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

Speed up FieldCache.CacheEntry toString by setting initial StringBuilder capacity

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: trunk, 6.1
    • Component/s: core/search
    • Labels:
      None
    • Lucene Fields:
      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.

      1. LUCENE-7115.patch
        0.7 kB
        Gregory Chanan

        Activity

        Hide
        gchanan Gregory Chanan added a comment -

        I uploaded a patch based on a previous version, going to upload a new one shortly.

        Show
        gchanan Gregory Chanan added a comment - I uploaded a patch based on a previous version, going to upload a new one shortly.
        Hide
        markrmiller@gmail.com Mark Miller added a comment -

        +1 - makes sense to size for what's coming.

        Show
        markrmiller@gmail.com Mark Miller added a comment - +1 - makes sense to size for what's coming.
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 56292fd4efb1749533d5d7dcd7235ebe89187099 in lucene-solr's branch refs/heads/master from Gregory Chanan
        [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=56292fd ]

        LUCENE-7115: Speed up FieldCache.CacheEntry toString by setting initial StringBuilder capacity

        Show
        jira-bot ASF subversion and git services added a comment - Commit 56292fd4efb1749533d5d7dcd7235ebe89187099 in lucene-solr's branch refs/heads/master from Gregory Chanan [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=56292fd ] LUCENE-7115 : Speed up FieldCache.CacheEntry toString by setting initial StringBuilder capacity
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 0926cecae647862760068d5eb0c8e8bc5afc6a79 in lucene-solr's branch refs/heads/branch_6x from Gregory Chanan
        [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=0926cec ]

        LUCENE-7115: Speed up FieldCache.CacheEntry toString by setting initial StringBuilder capacity

        Show
        jira-bot ASF subversion and git services added a comment - Commit 0926cecae647862760068d5eb0c8e8bc5afc6a79 in lucene-solr's branch refs/heads/branch_6x from Gregory Chanan [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=0926cec ] LUCENE-7115 : Speed up FieldCache.CacheEntry toString by setting initial StringBuilder capacity
        Hide
        gchanan Gregory Chanan added a comment -

        Thanks for the review, Mark, committed to trunk and 6.1

        Show
        gchanan Gregory Chanan added a comment - Thanks for the review, Mark, committed to trunk and 6.1

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development