You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@velocity.apache.org by by...@apache.org on 2009/01/04 15:57:12 UTC
svn commit: r731264 - in /velocity/engine/trunk/experimental/benchmark: ./
Benchmark.java main.vm run.sh
Author: byron
Date: Sun Jan 4 06:57:12 2009
New Revision: 731264
URL: http://svn.apache.org/viewvc?rev=731264&view=rev
Log:
Added jrat to test harness
Modified:
velocity/engine/trunk/experimental/benchmark/ (props changed)
velocity/engine/trunk/experimental/benchmark/Benchmark.java
velocity/engine/trunk/experimental/benchmark/main.vm
velocity/engine/trunk/experimental/benchmark/run.sh
Propchange: velocity/engine/trunk/experimental/benchmark/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Sun Jan 4 06:57:12 2009
@@ -1 +1,4 @@
*.class
+jrat.output
+jrat.xml
+shiftone-jrat.jar
Modified: velocity/engine/trunk/experimental/benchmark/Benchmark.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/experimental/benchmark/Benchmark.java?rev=731264&r1=731263&r2=731264&view=diff
==============================================================================
--- velocity/engine/trunk/experimental/benchmark/Benchmark.java (original)
+++ velocity/engine/trunk/experimental/benchmark/Benchmark.java Sun Jan 4 06:57:12 2009
@@ -19,7 +19,9 @@
* under the License.
*/
+import java.io.IOException;
import java.io.StringWriter;
+import java.io.Writer;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
@@ -51,8 +53,8 @@
Properties props = new Properties();
props.setProperty(RuntimeConstants.FILE_RESOURCE_LOADER_CACHE, "true");
props.setProperty(RuntimeConstants.VM_LIBRARY, "vmlib1.vm,vmlib2.vm");
- props.setProperty(RuntimeConstants.RESOURCE_MANAGER_DEFAULTCACHE_SIZE, "0");
- //props.setProperty(RuntimeConstants.RUNTIME_REFERENCES_STRICT, "true");
+ props.setProperty(RuntimeConstants.RESOURCE_MANAGER_DEFAULTCACHE_SIZE, "20");
+ props.setProperty(RuntimeConstants.RUNTIME_REFERENCES_STRICT, "true");
VelocityEngine vengine = new VelocityEngine();
vengine.init(props);
@@ -105,7 +107,7 @@
{
for (int i = 0; i < runCnt; i++)
{
- StringWriter writer = new StringWriter(10000);
+ Writer writer = new FastWriter();
// We do the setup inside the loop so we can be a little realistic
// Since this type of setup would be done in a real application,
@@ -130,13 +132,15 @@
catch(Exception e)
{
System.out.println(e);
+ e.printStackTrace();
runError = true;
System.out.println("Errors during run");
System.exit(1);
}
}
}
-
+
+
/**
* Test Object to be referenced from the template
*/
@@ -147,5 +151,81 @@
{
return name;
}
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
}
-}
\ No newline at end of file
+
+}
+
+
+
+class FastWriter extends Writer
+{
+
+ @Override
+ public Writer append(char c) throws IOException
+ {
+ throw new AssertionError("Bad method call");
+ }
+
+ @Override
+ public Writer append(CharSequence csq, int start, int end)
+ throws IOException
+ {
+ throw new AssertionError("Bad method call");
+ }
+
+ @Override
+ public Writer append(CharSequence csq) throws IOException
+ {
+ throw new AssertionError("Bad method call");
+ }
+
+ @Override
+ public void close() throws IOException
+ {
+ throw new AssertionError("Bad method call");
+ }
+
+ @Override
+ public void flush() throws IOException
+ {
+ throw new AssertionError("Bad method call");
+ }
+
+ @Override
+ public void write(char[] cbuf, int off, int len) throws IOException
+ {
+ throw new AssertionError("Bad method call");
+ }
+
+ @Override
+ public void write(char[] cbuf) throws IOException
+ {
+ }
+
+ @Override
+ public void write(int c) throws IOException
+ {
+ throw new AssertionError("Bad method call");
+ }
+
+ @Override
+ public void write(String str, int off, int len) throws IOException
+ {
+ throw new AssertionError("Bad method call");
+ }
+
+ @Override
+ public void write(String str) throws IOException
+ {
+ }
+
+}
+
+
+
+
Modified: velocity/engine/trunk/experimental/benchmark/main.vm
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/experimental/benchmark/main.vm?rev=731264&r1=731263&r2=731264&view=diff
==============================================================================
--- velocity/engine/trunk/experimental/benchmark/main.vm (original)
+++ velocity/engine/trunk/experimental/benchmark/main.vm Sun Jan 4 06:57:12 2009
@@ -26,17 +26,24 @@
This is some lines of text
This is some lines of text
#end
+
+ #vm_macro1($test4 $test5)
+ #vm_macro2($test8 $test9)
+ #vm_macro1($test4 $test5)
+ #vm_macro2($test8 $test9)
+ #vm_macro1($test4 $test5)
+ #vm_macro2($test8 $test9)
#set($v1 = "some text 1")
#set($v2 = "some text 1")
#set($v3 = "some text 1")
#set($v4 = "some text 1")
#set($v5 = "some text 1")
- #set($v6 = $test1.name)
- #set($v7 = $test2.name)
- #set($v8 = $test3.name)
- #set($v9 = $test4.name)
- #set($v10 = $test5.name)
+ #set($test1.name = $test1.name)
+ #set($test2.name = $test2.name)
+ #set($test3.name = $test3.name)
+ #set($test4.name = $test4.name)
+ #set($test5.name = $test5.name)
#if ($i > 5)
Modified: velocity/engine/trunk/experimental/benchmark/run.sh
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/experimental/benchmark/run.sh?rev=731264&r1=731263&r2=731264&view=diff
==============================================================================
--- velocity/engine/trunk/experimental/benchmark/run.sh (original)
+++ velocity/engine/trunk/experimental/benchmark/run.sh Sun Jan 4 06:57:12 2009
@@ -23,13 +23,27 @@
VELOCITY_PATH=velocity.jar
if [[ ! -f $VELOCITY_PATH ]]; then
VELOCITY_PATH=$ROOT/bin/classes
- echo velocity.jar was not found in this directory, so we are using the classes in:
+ echo velocity.jar was not found in this directory, so we are using classes in:
echo $VELOCITY_PATH
else
echo Found $VELOCITY_PATH in the current directory, so we are going to use it!
fi
+JRAT_JAR=shiftone-jrat.jar
+if [[ -f $JRAT_JAR ]]; then
+ echo Found $JRAT_JAR, We are going to use it!
+ echo Adding -javaagent:shiftone-jrat.jar to the java command line
+ JRAT_SWITCH=-javaagent:shiftone-jrat.jar
+fi
+
CP=$COMMON_LANG:$COMMON_COLL:$VELOCITY_PATH:.
-javac -cp $CP Benchmark.java
-time java -server -Xmx50M -cp $CP Benchmark
+COMPILE="javac -cp $CP Benchmark.java"
+
+if ! $COMPILE ; then
+ echo Ooops, failed to compile, comand line:
+ echo $COMPILE
+ exit 1
+fi
+
+time java -server -Xmx50M $JRAT_SWITCH -cp $CP Benchmark