You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by "Henning P. Schmiedehausen" <hp...@intermeta.de> on 2003/07/24 09:44:48 UTC

[PATCH] - Texen Task should cache its templates

[Duh! Posted that to the users group first. Sorry. ]

I'm using the Torque data sql task to generate SQL statements from an
XML file. This task is based on the texen task in Velocity.

Torque does this by rapidly loading the same templates over and over
again (namely row.vm and val.vm) from the class path loader.

In the end, this task needs about 300 MBytes or RAM for translating
about 1500 lines of XML file.

There seems to be a bug in the class path loader which does not free
non-cached templates from memory.

However, simply setting the texen task to cache the templates leads
not only to a speedup of about 15 but also to constant memory
usage. Please apply this patch (vs. 1.3.1)

	Regards
		Henning



Index: src/java/org/apache/velocity/texen/ant/TexenTask.java
===================================================================
RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/texen/ant/TexenTask.java,v
retrieving revision 1.37
diff -u -b -r1.37 TexenTask.java
--- src/java/org/apache/velocity/texen/ant/TexenTask.java       6 Dec 2001 07:46:47 -0000       1.37
+++ src/java/org/apache/velocity/texen/ant/TexenTask.java       24 Jul 2003 07:40:14 -0000
@@ -442,11 +442,11 @@
 
                 Velocity.setProperty(
                     "classpath." + Velocity.RESOURCE_LOADER + 
-                        ".cache", "false");
+                        ".cache", "true");
 
                 Velocity.setProperty(
                     "classpath." + Velocity.RESOURCE_LOADER + 
-                        ".modificationCheckInterval", "2");
+                        ".modificationCheckInterval", "2000");
             }
             
             Velocity.init();



-- 
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen          INTERMETA GmbH
hps@intermeta.de        +49 9131 50 654 0   http://www.intermeta.de/

Java, perl, Solaris, Linux, xSP Consulting, Web Services 
freelance consultant -- Jakarta Turbine Development  -- hero for hire

"You are being far too rational for this discussion."  
       --- Scott Robert Ladd in <3F...@coyotegulch.com>

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org