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

Reduce usage of String.intern(), performance is terrible

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.4, 2.4.1
    • 2.9
    • None
    • None
    • Windows Server 2003 x64
      Hotspot JDK 1.6.0_12 64-bit

    • New, Patch Available

    Description

      I profiled a simple MatchAllDocsQuery() against ~1.5 million documents (8 fields of short text, Field.Store.YES,Field.Index.NOT_ANALYZED_NO_NORMS), then retrieved all documents via searcher.doc(i, fs). String.intern() showed up as a top hotspot (see attached screenshot), so i implemented a small optimization to not intern() for every new Field(), instead forcing the intern in the FieldInfos class and adding a optional "internName" constructor to Field. This reduced execution time for searching and iterating through all documents by 35%. Results were similar for -server and -client.

      TRUNK (2.9) w/out patch: matched 1435563 in 8884 ms/search
      TRUNK (2.9) w/patch: matched 1435563 in 5786 ms/search

      Attachments

        Issue Links

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            mikemccand Michael McCandless
            peger@automotive.com Patrick Eger
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment