You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@velocity.apache.org by nb...@apache.org on 2008/08/13 07:07:25 UTC
svn commit: r685442 -
/velocity/engine/trunk/src/java/org/apache/velocity/runtime/VelocimacroManager.java
Author: nbubna
Date: Tue Aug 12 22:07:25 2008
New Revision: 685442
URL: http://svn.apache.org/viewvc?rev=685442&view=rev
Log:
keep a reference to global namespace as it is frequently used (slight performance improvement for VELOCITY-607)
Modified:
velocity/engine/trunk/src/java/org/apache/velocity/runtime/VelocimacroManager.java
Modified: velocity/engine/trunk/src/java/org/apache/velocity/runtime/VelocimacroManager.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/java/org/apache/velocity/runtime/VelocimacroManager.java?rev=685442&r1=685441&r2=685442&view=diff
==============================================================================
--- velocity/engine/trunk/src/java/org/apache/velocity/runtime/VelocimacroManager.java (original)
+++ velocity/engine/trunk/src/java/org/apache/velocity/runtime/VelocimacroManager.java Tue Aug 12 22:07:25 2008
@@ -53,6 +53,9 @@
/** Hash of namespace hashes. */
private final Map namespaceHash = MapFactory.create(17, 0.5f, 20, false);
+ /** reference to global namespace hash */
+ private final Map globalNamespace;
+
/** set of names of library tempates/namespaces */
private final Set libraries = Collections.synchronizedSet(new HashSet());
@@ -73,7 +76,7 @@
* add the global namespace to the namespace hash. We always have that.
*/
- addNamespace(GLOBAL_NAMESPACE);
+ globalNamespace = addNamespace(GLOBAL_NAMESPACE);
}
/**
@@ -110,7 +113,7 @@
boolean isLib = true;
- MacroEntry exist = (MacroEntry) getNamespace(GLOBAL_NAMESPACE).get(vmName);
+ MacroEntry exist = (MacroEntry) globalNamespace.get(vmName);
if (registerFromLib)
{
@@ -158,7 +161,7 @@
* now add it
*/
- getNamespace(GLOBAL_NAMESPACE).put(vmName, me);
+ globalNamespace.put(vmName, me);
return true;
}
@@ -230,7 +233,7 @@
* if it's in the global namespace
*/
- MacroEntry me = (MacroEntry) getNamespace(GLOBAL_NAMESPACE).get(vmName);
+ MacroEntry me = (MacroEntry) globalNamespace.get(vmName);
if (me != null)
{
@@ -427,7 +430,7 @@
* if it's in the global namespace
*/
- MacroEntry me = (MacroEntry) getNamespace(GLOBAL_NAMESPACE).get(vmName);
+ MacroEntry me = (MacroEntry) globalNamespace.get(vmName);
if (me != null)
{