Uploaded image for project: 'XalanJ2'
  1. XalanJ2
  2. XALANJ-2596

Removing unnecessary creation of FunctionTable

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 2.7.2
    • None
    • XPath
    • Security Level: No security risk; visible to anyone (Ordinary problems in Xalan projects. Anybody can view the issue.)
    • None
    • Patch

    Description

      I found some inefficiencies in creation of org.apache.xpath.FunctionTable instances in the code base. Most of the time, a FunctionTable instance is created and used only to get at the default Functions stored in its static m_functions field. The only time an instance of the FunctionTable is necessary is when custom Functions are being installed (so the places where installFunction() is called), but in the code base there are very few points where this occurs.

      To avoid creation of FunctionTable instances that are of very little use, I introduce a singleton (defined in FunctionTable) that represents the default FunctionTable. In all places that instantiate a new instance of FunctionTable without installing custom Functions, I remove the instantiation and instead use this singleton.

      I will attach a patch file concerning my changes.

      Attachments

        1. patch.patch
          2 kB
          August Shi

        Activity

          People

            shathaway Steven J. Hathaway
            awshi2 August Shi
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: