Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 7.0, 6.6
    • Component/s: None
    • Labels:
      None
    • Lucene Fields:
      New, Patch Available
    • Flags:
      Patch

      Description

      http://findbugs.sourceforge.net/bugDescriptions.html#DM_STRING_CTOR
      Removing the extra constructor calls will avoid heap allocations while behaving just the same as the original code.

      1. LUCENE-7743.patch
        8 kB
        Daniel Jelinski

        Issue Links

          Activity

          Hide
          djelinski Daniel Jelinski added a comment -

          The patch addresses the obvious cases, i.e. all cases in non-test code, and tests where the string copy is immediately discarded, or where string identity is not likely to be of concern.
          I left a few cases that looked like they might be implicitly testing non-interned strings.
          Note that the removed comment in SolrDefaultHighlighter no longer holds (at least in OpenJDK and Oracle Java); see http://mail.openjdk.java.net/pipermail/core-libs-dev/2012-May/010257.html for details.

          Show
          djelinski Daniel Jelinski added a comment - The patch addresses the obvious cases, i.e. all cases in non-test code, and tests where the string copy is immediately discarded, or where string identity is not likely to be of concern. I left a few cases that looked like they might be implicitly testing non-interned strings. Note that the removed comment in SolrDefaultHighlighter no longer holds (at least in OpenJDK and Oracle Java); see http://mail.openjdk.java.net/pipermail/core-libs-dev/2012-May/010257.html for details.
          Hide
          dweiss Dawid Weiss added a comment -

          Looks good to me.

          Show
          dweiss Dawid Weiss added a comment - Looks good to me.
          Hide
          jpountz Adrien Grand added a comment -

          It looks good to me too. I'll merge it.

          Show
          jpountz Adrien Grand added a comment - It looks good to me too. I'll merge it.
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 390ef9af9fa081c90370f69b001cf7ec83c8f1bb in lucene-solr's branch refs/heads/master from Adrien Grand
          [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=390ef9a ]

          LUCENE-7743: Avoid calling new String(String).

          Show
          jira-bot ASF subversion and git services added a comment - Commit 390ef9af9fa081c90370f69b001cf7ec83c8f1bb in lucene-solr's branch refs/heads/master from Adrien Grand [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=390ef9a ] LUCENE-7743 : Avoid calling new String(String).
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 03e50781463827a5d8188fccf0307f72dea4e450 in lucene-solr's branch refs/heads/branch_6x from Adrien Grand
          [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=03e5078 ]

          LUCENE-7743: Avoid calling new String(String).

          Show
          jira-bot ASF subversion and git services added a comment - Commit 03e50781463827a5d8188fccf0307f72dea4e450 in lucene-solr's branch refs/heads/branch_6x from Adrien Grand [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=03e5078 ] LUCENE-7743 : Avoid calling new String(String).

            People

            • Assignee:
              Unassigned
              Reporter:
              djelinski Daniel Jelinski
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development