velocity-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From by...@apache.org
Subject svn commit: r732250 - in /velocity/engine/trunk/src/java/org/apache/velocity: ./ context/ runtime/ runtime/directive/ runtime/parser/node/
Date Wed, 07 Jan 2009 07:37:11 GMT
Author: byron
Date: Tue Jan  6 23:37:10 2009
New Revision: 732250

URL: http://svn.apache.org/viewvc?rev=732250&view=rev
Log:
Intern string for better memory usage, and peformance for variable and macro name references

Modified:
    velocity/engine/trunk/src/java/org/apache/velocity/VelocityContext.java
    velocity/engine/trunk/src/java/org/apache/velocity/context/AbstractContext.java
    velocity/engine/trunk/src/java/org/apache/velocity/runtime/RuntimeInstance.java
    velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/Macro.java
    velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/RuntimeMacro.java
    velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTIdentifier.java
    velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTReference.java

Modified: velocity/engine/trunk/src/java/org/apache/velocity/VelocityContext.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/java/org/apache/velocity/VelocityContext.java?rev=732250&r1=732249&r2=732250&view=diff
==============================================================================
--- velocity/engine/trunk/src/java/org/apache/velocity/VelocityContext.java (original)
+++ velocity/engine/trunk/src/java/org/apache/velocity/VelocityContext.java Tue Jan  6 23:37:10
2009
@@ -20,10 +20,12 @@
  */
 
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.Map;
 
 import org.apache.velocity.context.AbstractContext;
 import org.apache.velocity.context.Context;
+import org.apache.velocity.runtime.RuntimeServices;
 
 /**
  *  General purpose implemention of the application Context
@@ -183,5 +185,5 @@
         {
         }
         return clone;
-    }
+    }    
 }

Modified: velocity/engine/trunk/src/java/org/apache/velocity/context/AbstractContext.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/java/org/apache/velocity/context/AbstractContext.java?rev=732250&r1=732249&r2=732250&view=diff
==============================================================================
--- velocity/engine/trunk/src/java/org/apache/velocity/context/AbstractContext.java (original)
+++ velocity/engine/trunk/src/java/org/apache/velocity/context/AbstractContext.java Tue Jan
 6 23:37:10 2009
@@ -161,7 +161,7 @@
             return null;
         }
         
-        return internalPut(key, value);
+        return internalPut(key.intern(), value);
     }
 
     /**

Modified: velocity/engine/trunk/src/java/org/apache/velocity/runtime/RuntimeInstance.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/java/org/apache/velocity/runtime/RuntimeInstance.java?rev=732250&r1=732249&r2=732250&view=diff
==============================================================================
--- velocity/engine/trunk/src/java/org/apache/velocity/runtime/RuntimeInstance.java (original)
+++ velocity/engine/trunk/src/java/org/apache/velocity/runtime/RuntimeInstance.java Tue Jan
 6 23:37:10 2009
@@ -1622,7 +1622,7 @@
                                           String argArray[],
                                           String sourceTemplate )
     {
-        return vmFactory.addVelocimacro(name, macro,  argArray,  sourceTemplate);
+        return vmFactory.addVelocimacro(name.intern(), macro,  argArray,  sourceTemplate);
     }
 
     /**
@@ -1646,7 +1646,7 @@
                                           String argArray[],
                                           String sourceTemplate )
     {
-        return vmFactory.addVelocimacro(name, macro,  argArray,  sourceTemplate);
+        return vmFactory.addVelocimacro(name.intern(), macro,  argArray,  sourceTemplate);
     }
     
     
@@ -1659,7 +1659,7 @@
      */
     public boolean isVelocimacro( String vmName, String templateName )
     {
-        return vmFactory.isVelocimacro(vmName, templateName);
+        return vmFactory.isVelocimacro(vmName.intern(), templateName);
     }
 
     /**

Modified: velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/Macro.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/Macro.java?rev=732250&r1=732249&r2=732250&view=diff
==============================================================================
--- velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/Macro.java (original)
+++ velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/Macro.java Tue Jan
 6 23:37:10 2009
@@ -231,6 +231,7 @@
                 }
             }
 
+            argArray[i] = argArray[i].intern();
             i++;
         }
 

Modified: velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/RuntimeMacro.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/RuntimeMacro.java?rev=732250&r1=732249&r2=732250&view=diff
==============================================================================
--- velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/RuntimeMacro.java
(original)
+++ velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/RuntimeMacro.java
Tue Jan  6 23:37:10 2009
@@ -86,8 +86,8 @@
             throw new IllegalArgumentException("Null arguments");
         }
         
-        this.macroName = macroName;
-        this.sourceTemplate = sourceTemplate;
+        this.macroName = macroName.intern();
+        this.sourceTemplate = sourceTemplate.intern();
     }
 
     /**

Modified: velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTIdentifier.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTIdentifier.java?rev=732250&r1=732249&r2=732250&view=diff
==============================================================================
--- velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTIdentifier.java
(original)
+++ velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTIdentifier.java
Tue Jan  6 23:37:10 2009
@@ -101,7 +101,7 @@
     {
         super.init(context, data);
 
-        identifier = getFirstToken().image;
+        identifier = getFirstToken().image.intern();
 
         uberInfo = new Info(getTemplateName(), getLine(), getColumn());
 

Modified: velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTReference.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTReference.java?rev=732250&r1=732249&r2=732250&view=diff
==============================================================================
--- velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTReference.java
(original)
+++ velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/node/ASTReference.java
Tue Jan  6 23:37:10 2009
@@ -130,7 +130,7 @@
          *  so it's thread- and context-safe
          */
 
-        rootString = getRoot();
+        rootString = getRoot().intern();
 
         numChildren = jjtGetNumChildren();
         



Mime
View raw message