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

Default Attributes are expensive

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 4.9, 6.0
    • modules/analysis
    • None
    • New

    Description

      Changes like LUCENE-5634 make it clear that the default AttributeFactory stuff has a very high cost: weakmaps/reflection/etc.

      Additionally I think clearAttributes() is more expensive than it should be: it has to traverse a linked-list, calling clear() per token.

      Operations like cloning (save/restoreState) have a high cost tll.

      Maybe we can have a better Default? In other words, rename DEFAULT_ATTRIBUTE_FACTORY to REFLECTION_ATTRIBUTE_FACTORY, and instead have a faster default factory that just has one AttributeImpl with the "core ones" that 95% of users are dealing with (TOKEN_ATTRIBUTE_FACTORY?): anything outside of that falls back to reflection.

      Attachments

        1. LUCENE-5638.patch
          0.5 kB
          Uwe Schindler
        2. LUCENE-5638.patch
          18 kB
          Robert Muir
        3. LUCENE-5638.patch
          19 kB
          Robert Muir
        4. LUCENE-5638.patch
          14 kB
          Robert Muir
        5. LUCENE-5638.patch
          15 kB
          Robert Muir

        Activity

          People

            Unassigned Unassigned
            rcmuir Robert Muir
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment