Discussion:
[jira] [Created] (XALANJ-2596) Removing unnecessary creation of FunctionTable
August Shi (JIRA)
2015-05-07 02:38:00 UTC
Permalink
August Shi created XALANJ-2596:
----------------------------------

Summary: Removing unnecessary creation of FunctionTable
Key: XALANJ-2596
URL: https://issues.apache.org/jira/browse/XALANJ-2596
Project: XalanJ2
Issue Type: Improvement
Security Level: No security risk; visible to anyone (Ordinary problems in Xalan projects. Anybody can view the issue.)
Components: XPath
Affects Versions: 2.7.2
Reporter: August Shi
Assignee: Steven J. Hathaway
Priority: Minor


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.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-***@xalan.apache.org
For additional commands, e-mail: dev-***@xalan.apache.org
August Shi (JIRA)
2015-05-07 02:39:00 UTC
Permalink
[ https://issues.apache.org/jira/browse/XALANJ-2596?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

August Shi updated XALANJ-2596:
-------------------------------
Attachment: patch.patch

Patch for using singleton default FunctionTable
Post by August Shi (JIRA)
Removing unnecessary creation of FunctionTable
----------------------------------------------
Key: XALANJ-2596
URL: https://issues.apache.org/jira/browse/XALANJ-2596
Project: XalanJ2
Issue Type: Improvement
Security Level: No security risk; visible to anyone(Ordinary problems in Xalan projects. Anybody can view the issue.)
Components: XPath
Affects Versions: 2.7.2
Reporter: August Shi
Assignee: Steven J. Hathaway
Priority: Minor
Attachments: patch.patch
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.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-***@xalan.apache.org
For additional commands, e-mail: dev-***@xalan.apache.org

Loading...