Lucene - Core
  1. Lucene - Core
  2. LUCENE-2288

Create EMPTY_ARGS constsant in SnowballProgram instead of allocating new Object[0]

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.0-ALPHA
    • Component/s: modules/analysis
    • Labels:
      None
    • Lucene Fields:
      New, Patch Available

      Description

      Instead of allocating new Object[0] create a proper constant in SnowballProgram. The same (for new Class[0]) is created in Among, although it's less critical because Among is called from static initializers ... Patch will follow shortly.

        Activity

        Hide
        Robert Muir added a comment -

        Committed revision 917161.

        Thanks Shai!

        Show
        Robert Muir added a comment - Committed revision 917161. Thanks Shai!
        Hide
        Shai Erera added a comment -

        Thanks Robert. I never checked if those methods are actually code, as I didn't do it to earn any CPU cycles back. I just followed good coding practice, and since it appeared in two places, thought that a constant will look like a bit less waste. If you're sure those are not called by the other stemmers (and I'm sure you are ), then I'm fine if you leave those out as well

        Show
        Shai Erera added a comment - Thanks Robert. I never checked if those methods are actually code, as I didn't do it to earn any CPU cycles back. I just followed good coding practice, and since it appeared in two places, thought that a constant will look like a bit less waste. If you're sure those are not called by the other stemmers (and I'm sure you are ), then I'm fine if you leave those out as well
        Hide
        Robert Muir added a comment -

        thanks Shai, the patch looks good to me, though i hope it only affects the Lovins stemmer (or in case someone has written their own Snowball stemmer), as the others should not be using this reflection!

        will commit in a few days unless someone objects.

        Show
        Robert Muir added a comment - thanks Shai, the patch looks good to me, though i hope it only affects the Lovins stemmer (or in case someone has written their own Snowball stemmer), as the others should not be using this reflection! will commit in a few days unless someone objects.
        Hide
        Shai Erera added a comment -

        Forgot to mention all analysis tests pass.

        Show
        Shai Erera added a comment - Forgot to mention all analysis tests pass.
        Hide
        Shai Erera added a comment -

        Patch w/ the trivial change.

        Show
        Shai Erera added a comment - Patch w/ the trivial change.

          People

          • Assignee:
            Robert Muir
            Reporter:
            Shai Erera
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development