Commits

Anonymous committed d0f7b92

Added in MVEL comparisons in performance tests.

Comments (0)

Files changed (6)

         <SOURCES />
       </library>
     </orderEntry>
+    <orderEntry type="module-library">
+      <library name="mvel">
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/lib/build/mvel.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="asm">
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/lib/build/asm.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
     <orderEntryProperties />
   </component>
 </module>
   </component>
   <component name="ChangeListManager">
     <list default="true" name="Default" comment="">
-      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/pom.xml" afterPath="$PROJECT_DIR$/pom.xml" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/OGNL.iml" afterPath="$PROJECT_DIR$/OGNL.iml" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/test/java/org/ognl/test/Performance.java" afterPath="$PROJECT_DIR$/src/test/java/org/ognl/test/Performance.java" />
+      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/lib/build/asm.jar" />
+      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/lib/build/mvel.jar" />
       <change type="MODIFICATION" beforePath="$PROJECT_DIR$/OGNL.iws" afterPath="$PROJECT_DIR$/OGNL.iws" />
+      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/osbuild.xml" afterPath="$PROJECT_DIR$/osbuild.xml" />
     </list>
   </component>
   <component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
   </component>
   <component name="FileEditorManager">
     <leaf>
-      <file leaf-file-name="pom.xml" pinned="false" current="true" current-in-tab="true">
-        <entry file="file://$PROJECT_DIR$/pom.xml">
+      <file leaf-file-name="osbuild.xml" pinned="false" current="false" current-in-tab="false">
+        <entry file="file://$PROJECT_DIR$/osbuild.xml">
           <provider selected="true" editor-type-id="text-editor">
-            <state line="44" column="0" selection-start="1401" selection-end="1401" vertical-scroll-proportion="0.41426146">
+            <state line="119" column="0" selection-start="4425" selection-end="4425" vertical-scroll-proportion="0.30135822">
               <folding />
             </state>
           </provider>
         </entry>
       </file>
+      <file leaf-file-name="Performance.java" pinned="false" current="true" current-in-tab="true">
+        <entry file="file://$PROJECT_DIR$/src/test/java/org/ognl/test/Performance.java">
+          <provider selected="true" editor-type-id="text-editor">
+            <state line="317" column="20" selection-start="12601" selection-end="12601" vertical-scroll-proportion="1.4719195">
+              <folding>
+                <element signature="imports" expanded="true" />
+              </folding>
+            </state>
+          </provider>
+        </entry>
+      </file>
     </leaf>
   </component>
   <component name="FindManager">
       <setting name="OPEN_NEW_TAB" value="false" />
     </FindUsagesManager>
   </component>
+  <component name="GlobalLibrariesConfigurable.UI">
+    <option name="proportions">
+      <SplitterProportionsDataImpl>
+        <option name="proportions">
+          <collection>
+            <option value="0.2" />
+          </collection>
+        </option>
+      </SplitterProportionsDataImpl>
+    </option>
+  </component>
   <component name="HierarchyBrowserManager">
     <option name="IS_AUTOSCROLL_TO_SOURCE" value="false" />
     <option name="SORT_ALPHABETICALLY" value="false" />
     <option name="HIDE_CLASSES_WHERE_METHOD_NOT_IMPLEMENTED" value="false" />
   </component>
+  <component name="JdkListConfigurable.UI">
+    <option name="proportions">
+      <SplitterProportionsDataImpl>
+        <option name="proportions">
+          <collection>
+            <option value="0.2" />
+          </collection>
+        </option>
+      </SplitterProportionsDataImpl>
+    </option>
+  </component>
   <component name="ModuleEditorState">
     <option name="LAST_EDITED_MODULE_NAME" />
     <option name="LAST_EDITED_TAB_NAME" />
   </component>
+  <component name="ModuleStructureConfigurable.UI">
+    <option name="proportions">
+      <SplitterProportionsDataImpl>
+        <option name="proportions">
+          <collection>
+            <option value="0.2" />
+            <option value="0.5" />
+          </collection>
+        </option>
+      </SplitterProportionsDataImpl>
+    </option>
+  </component>
   <component name="PackagesPane">
     <subPane>
       <PATH>
     <ConfirmationsSetting value="0" id="Add" />
     <ConfirmationsSetting value="0" id="Remove" />
   </component>
+  <component name="ProjectLibrariesConfigurable.UI">
+    <option name="proportions">
+      <SplitterProportionsDataImpl>
+        <option name="proportions">
+          <collection>
+            <option value="0.2" />
+          </collection>
+        </option>
+      </SplitterProportionsDataImpl>
+    </option>
+  </component>
   <component name="ProjectPane">
     <subPane>
       <PATH>
     </option>
     <option name="lastEditedConfigurable" value="Project 'OGNL'" />
   </component>
+  <component name="ProjectStructureConfigurable.UI">
+    <option name="proportion" value="0.15" />
+    <option name="sideProportion" value="0.2" />
+    <option name="lastEditedConfigurable" value="Modules" />
+  </component>
   <component name="ProjectView">
     <navigator currentView="ProjectPane" proportions="0.16666667" version="1" splitterProportion="0.5">
       <flattenPackages />
       <showLibraryContents />
       <hideEmptyPackages />
       <abbreviatePackageNames />
-      <showStructure PackagesPane="false" Scope="false" Favorites="false" ProjectPane="false" />
+      <showStructure Favorites="false" Scope="false" PackagesPane="false" ProjectPane="false" />
       <autoscrollToSource />
       <autoscrollFromSource />
       <sortByType />
         <option name="Make" value="true" />
       </method>
     </tempConfiguration>
-    <configuration default="true" type="Remote" factoryName="Remote">
-      <option name="USE_SOCKET_TRANSPORT" value="true" />
-      <option name="SERVER_MODE" value="false" />
-      <option name="SHMEM_ADDRESS" value="javadebug" />
-      <option name="HOST" value="localhost" />
-      <option name="PORT" value="5005" />
-    </configuration>
     <configuration default="true" type="Applet" factoryName="Applet">
       <module name="" />
       <option name="MAIN_CLASS_NAME" />
       <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
       <option name="ALTERNATIVE_JRE_PATH" />
     </configuration>
+    <configuration default="true" type="Remote" factoryName="Remote">
+      <option name="USE_SOCKET_TRANSPORT" value="true" />
+      <option name="SERVER_MODE" value="false" />
+      <option name="SHMEM_ADDRESS" value="javadebug" />
+      <option name="HOST" value="localhost" />
+      <option name="PORT" value="5005" />
+    </configuration>
     <configuration default="true" type="Application" factoryName="Application" enabled="false" merge="false">
       <option name="MAIN_CLASS_NAME" />
       <option name="VM_PARAMETERS" />
       <option name="ENABLE_SWING_INSPECTOR" value="false" />
       <option name="ENV_VARIABLES" />
       <module name="" />
+      <method>
+        <option name="Make" value="true" />
+      </method>
+    </configuration>
+    <configuration default="true" type="JUnit" factoryName="JUnit" enabled="false" merge="false">
+      <module name="" />
+      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
+      <option name="ALTERNATIVE_JRE_PATH" value="/usr/local/jdk1.6.0_02" />
+      <option name="PACKAGE_NAME" />
+      <option name="MAIN_CLASS_NAME" value="" />
+      <option name="METHOD_NAME" value="" />
+      <option name="TEST_OBJECT" value="class" />
+      <option name="VM_PARAMETERS" value="" />
+      <option name="PARAMETERS" value="" />
+      <option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
+      <option name="ENV_VARIABLES" />
+      <option name="ADDITIONAL_CLASS_PATH" />
+      <option name="TEST_SEARCH_SCOPE">
+        <value defaultName="wholeProject" />
+      </option>
+      <method>
+        <option name="Make" value="true" />
+      </method>
     </configuration>
     <configuration default="true" type="TestNG" factoryName="TestNG" enabled="false" merge="false">
       <module name="" />
         <option name="Make" value="true" />
       </method>
     </configuration>
-    <configuration default="true" type="JUnit" factoryName="JUnit" enabled="false" merge="false">
-      <module name="" />
-      <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
-      <option name="ALTERNATIVE_JRE_PATH" value="/usr/local/jdk1.6.0_02" />
-      <option name="PACKAGE_NAME" />
-      <option name="MAIN_CLASS_NAME" value="" />
-      <option name="METHOD_NAME" value="" />
-      <option name="TEST_OBJECT" value="class" />
-      <option name="VM_PARAMETERS" value="" />
-      <option name="PARAMETERS" value="" />
-      <option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
-      <option name="ENV_VARIABLES" />
-      <option name="ADDITIONAL_CLASS_PATH" />
-      <option name="TEST_SEARCH_SCOPE">
-        <value defaultName="wholeProject" />
-      </option>
-      <method>
-        <option name="Make" value="true" />
-      </method>
-    </configuration>
     <configuration default="true" type="#com.intellij.j2ee.web.tomcat.TomcatRunConfigurationFactory" factoryName="Local">
       <option name="WORKING_DIRECTORY" />
       <option name="HOST" value="localhost" />
       <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.24943718" order="1" />
       <window_info id="Maven projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="3" />
       <window_info id="Module Dependencies" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="3" />
+      <window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.25845736" order="0" />
       <window_info id="Dependency Viewer" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="8" />
-      <window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.25845736" order="0" />
       <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" order="2" />
       <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.3488372" order="6" />
       <window_info id="Duplicates" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="8" />
       <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.27369282" order="2" />
-      <window_info id="Regex" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32924837" order="8" />
       <window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="3" />
       <window_info id="IDEtalk Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="8" />
       <window_info id="IDEtalk" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="3" />
       <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" order="0" />
       <window_info id="EJB" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" order="4" />
       <window_info id="CVS" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" order="8" />
+      <window_info id="Regex" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32924837" order="8" />
     </layout>
   </component>
   <component name="VCS.FileViewConfiguration">
     <option name="PERFORM_EDIT_IN_BACKGROUND" value="true" />
     <option name="PERFORM_ADD_REMOVE_IN_BACKGROUND" value="true" />
     <option name="FORCE_NON_EMPTY_COMMENT" value="false" />
-    <option name="LAST_COMMIT_MESSAGE" value="Fixes OGNL-97.  Was doing the old root class casting logic on root expressions when it seems to be unneccessary now that everything is properly being populated in the context accessor/type class value stack." />
+    <option name="LAST_COMMIT_MESSAGE" value="Added in MVEL comparisons in performance tests." />
     <option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="true" />
     <option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="false" />
     <option name="REFORMAT_BEFORE_FILE_COMMIT" value="false" />
     <option name="UPDATE_GROUP_BY_CHANGELIST" value="false" />
     <option name="SHOW_FILE_HISTORY_AS_TREE" value="false" />
     <option name="FILE_HISTORY_SPLITTER_PROPORTION" value="0.6" />
-    <MESSAGE value="Fixes OGNL-75." />
-    <MESSAGE value="Fixes OGNL-76. ObjectPropertyAccessor was incorrectly trying to generate an array property reference in the setter code (ie java.lang.Object[].class) - which is of course invalid.  Changed to use the OgnlOps.toArray() style parameter conversion." />
     <MESSAGE value="Fixes OGNL-77. ASTAdd wasn't setting the context type before returning." />
     <MESSAGE value="Fixes TAPESTRY-1419. Needed to add () around widening expressions in ASTList." />
     <MESSAGE value="Fixes OGNL-84, OGNL-83.  Precasting statements were being stolen by ASTMethod for inner children incorrectly.  ASTProperty also wasn't setting the correct current type on previously indexed methods. &#10;&#10;Also reverted surefire version since someone there seems to have broken the current version." />
     <MESSAGE value="Fixes unicode bug in OgnlOps.escapeString() iso control handling." />
     <MESSAGE value="Fixes OGNL-98.  ASTRemainder was using the old method of source getting before the recent NumericExpression refactor was done." />
     <MESSAGE value="Fixes OGNL-97.  Was doing the old root class casting logic on root expressions when it seems to be unneccessary now that everything is properly being populated in the context accessor/type class value stack." />
+    <MESSAGE value="Made javassist a &quot;provided&quot; scope." />
+    <MESSAGE value="Added in MVEL comparisons in performance tests." />
   </component>
   <component name="VssConfiguration">
     <option name="CLIENT_PATH" value="" />
     <option name="myLastEditedConfigurable" />
   </component>
   <component name="editorHistoryManager">
-    <entry file="file://$PROJECT_DIR$/src/test/java/org/ognl/test/ArithmeticAndLogicalOperatorsTest.java">
-      <provider selected="true" editor-type-id="text-editor">
-        <state line="36" column="13" selection-start="1827" selection-end="1827" vertical-scroll-proportion="0.062866725">
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/src/test/java/org/ognl/test/MethodTest.java">
-      <provider selected="true" editor-type-id="text-editor">
-        <state line="48" column="51" selection-start="2469" selection-end="2469" vertical-scroll-proportion="0.2263202">
-          <folding />
-        </state>
-      </provider>
-    </entry>
-    <entry file="file://$PROJECT_DIR$/src/test/java/org/ognl/test/PropertyTest.java">
-      <provider selected="true" editor-type-id="text-editor">
-        <state line="118" column="46" selection-start="7830" selection-end="7830" vertical-scroll-proportion="0.76697403">
-          <folding />
-        </state>
-      </provider>
-    </entry>
     <entry file="file://$PROJECT_DIR$/src/test/java/org/ognl/test/objects/Simple.java">
       <provider selected="true" editor-type-id="text-editor">
         <state line="208" column="5" selection-start="4765" selection-end="4898" vertical-scroll-proportion="0.7485331">
         </state>
       </provider>
     </entry>
+    <entry file="file://$PROJECT_DIR$/build.xml">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="59" column="0" selection-start="1846" selection-end="1846" vertical-scroll-proportion="0.5670628">
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/osbuild.xml">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="119" column="0" selection-start="4425" selection-end="4425" vertical-scroll-proportion="0.30135822">
+          <folding />
+        </state>
+      </provider>
+    </entry>
+    <entry file="file://$PROJECT_DIR$/src/test/java/org/ognl/test/Performance.java">
+      <provider selected="true" editor-type-id="text-editor">
+        <state line="317" column="20" selection-start="12601" selection-end="12601" vertical-scroll-proportion="1.4719195">
+          <folding>
+            <element signature="imports" expanded="true" />
+          </folding>
+        </state>
+      </provider>
+    </entry>
   </component>
   <component name="testng.defaultConfiguration">
     <outputDirectory />

lib/build/asm.jar

Binary file added.

lib/build/mvel.jar

Binary file added.
             </fileset>
         </path>
         <java classname="org.ognl.test.Performance" classpathref="perf.cp">
-            <arg value="-server"/>
+            <arg line="-iterations 100000"/>
         </java>
     </target>
 

src/test/java/org/ognl/test/Performance.java

 import ognl.OgnlContext;
 import ognl.OgnlException;
 import ognl.SimpleNode;
+import org.mvel.MVEL;
 import org.ognl.test.objects.Bean1;
 
+import java.io.Serializable;
 import java.lang.reflect.Method;
 import java.text.DecimalFormat;
 import java.text.NumberFormat;
     private static boolean TIME_MODE;
     private static NumberFormat FACTOR_FORMAT = new DecimalFormat("0.000");
 
-    private String name;
-    private OgnlContext context = (OgnlContext) Ognl.createDefaultContext(null);
-    private Bean1 root = new Bean1();
-    private SimpleNode expression;
-    private SimpleNode compiledExpression;
-    private Method method;
-    private int iterations;
+    private String _name;
+    private OgnlContext _context = (OgnlContext) Ognl.createDefaultContext(null);
+    private Bean1 _root = new Bean1();
+    private SimpleNode _expression;
+    private SimpleNode _compiledExpression;
+    private Method _method;
+    private int _iterations;
+    private Serializable _mvelCompiled;
+    private String _expressionString;
+    private boolean _isMvel = false;
     private long t0;
     private long t1;
-    
+
     /*
-     * =================================================================== Private static classes
-     * ===================================================================
-     */
+    * =================================================================== Private static classes
+    * ===================================================================
+    */
     private static class Results
     {
 
         int iterations;
         long time;
+        boolean mvel;
 
-        public Results(int iterations, long time)
+        public Results(int iterations, long time, boolean mvel)
         {
             super();
             this.iterations = iterations;
             this.time = time;
+            this.mvel = mvel;
         }
-        
+
         public String getFactor(Results otherResults)
         {
             String ret = null;
-            
+
             if (TIME_MODE) {
                 float factor = 0;
-                
+
                 if (iterations < otherResults.iterations) {
                     factor = Math.max((float) otherResults.iterations, (float) iterations)
-                    / Math.min((float) otherResults.iterations, (float) iterations);
+                             / Math.min((float) otherResults.iterations, (float) iterations);
                 } else {
                     factor = Math.min((float) otherResults.iterations, (float) iterations)
-                    / Math.max((float) otherResults.iterations, (float) iterations);
+                             / Math.max((float) otherResults.iterations, (float) iterations);
                 }
-                
+
                 ret = FACTOR_FORMAT.format(factor);
                 if (iterations > otherResults.iterations)
                     ret += " times faster than ";
                 else
                     ret += " times slower than ";
-                
+
             } else {
                 float factor = Math.max((float) otherResults.time, (float) time)
-                / Math.min((float) otherResults.time, (float) time);
-                
+                               / Math.min((float) otherResults.time, (float) time);
+
                 ret = FACTOR_FORMAT.format(factor);
                 if (time < otherResults.time)
                     ret += " times faster than ";
                 else
                     ret += " times slower than ";
             }
-            
+
             return ret;
         }
     }
             TIME_MODE = true;
             MAX_TIME = 1500;
         }
-        
+
         try {
             Performance[] tests = new Performance[] {
                     new Performance("Constant", "100 + 20 * 5", "testConstantExpression"),
+                    new Performance("Constant", "100 + 20 * 5", "testConstantExpression", true),
                     new Performance("Single Property", "bean2", "testSinglePropertyExpression"),
+                    new Performance("Single Property", "bean2", "testSinglePropertyExpression", true),
                     new Performance("Property Navigation", "bean2.bean3.value", "testPropertyNavigationExpression"),
-                    new Performance("Property Setting with context key", "bean2.bean3.nullValue", "testPropertyNavigationSetting"),
+                    new Performance("Property Navigation", "bean2.bean3.value", "testPropertyNavigationExpression", true),
+                    /*new Performance("Property Setting with context key", "bean2.bean3.nullValue", "testPropertyNavigationSetting"),
+                    new Performance("Property Setting with context key", "bean2.bean3.nullValue", "testPropertyNavigationSetting", true), */                    
                     new Performance("Property Navigation and Comparison", "bean2.bean3.value <= 24",
-                    "testPropertyNavigationAndComparisonExpression"),
+                                    "testPropertyNavigationAndComparisonExpression"),
+                    new Performance("Property Navigation and Comparison", "bean2.bean3.value <= 24",
+                                    "testPropertyNavigationAndComparisonExpression", true),
+                    /* new Performance("Property Navigation with Indexed Access", "bean2.bean3.indexedValue[25]",
+                                    "testIndexedPropertyNavigationExpression"),
                     new Performance("Property Navigation with Indexed Access", "bean2.bean3.indexedValue[25]",
-                    "testIndexedPropertyNavigationExpression"),
+                                    "testIndexedPropertyNavigationExpression", true), */
                     new Performance("Property Navigation with Map Access", "bean2.bean3.map['foo']",
-                    "testPropertyNavigationWithMapExpression"),
+                                    "testPropertyNavigationWithMapExpression"),
+                    new Performance("Property Navigation with Map Access", "bean2.bean3.map['foo']",
+                                    "testPropertyNavigationWithMapExpression", true),
+                    /* new Performance("Property Navigation with Map value set", "bean2.bean3.map['foo']",
+                                    "testPropertyNavigationWithMapSetting"),
                     new Performance("Property Navigation with Map value set", "bean2.bean3.map['foo']",
-                    "testPropertyNavigationWithMapSetting")
+                                    "testPropertyNavigationWithMapSetting", true) */
             };
-            
+
             boolean timeMode = TIME_MODE;
             boolean iterMode = ITERATIONS_MODE;
             long maxTime = MAX_TIME;
             int maxIterations = MAX_ITERATIONS;
-            
-            TIME_MODE = false;
-            ITERATIONS_MODE = true;
-            maxIterations = 1000;
-            
+
+            //TIME_MODE = false;
+            //ITERATIONS_MODE = true;
+            //maxIterations = 1000;
+
             runTests(tests, false);
-            
+
             TIME_MODE = timeMode;
             ITERATIONS_MODE = iterMode;
             MAX_TIME = maxTime;
             MAX_ITERATIONS = maxIterations;
-            
+
             System.out.println("\n\n============================================================================\n");
 
             Thread.sleep(2500);
             runTests(tests, true);
 
             //Thread.sleep(2000);
-            
+
             System.out.println("\n\n============================================================================\n");
             // runTests(tests);
-            
+
         } catch (Exception ex) {
             ex.printStackTrace();
         }
     }
-    
+
     static void runTests(Performance[] tests, boolean output)
-    throws Exception
+            throws Exception
     {
         for(int i = 0; i < tests.length; i++) {
             Performance perf = tests[i];
-            
+
             try {
-                
-                Results javaResults = perf.testJava(), 
-                interpretedResults = perf.testExpression(false), 
-                compiledResults = perf.testExpression(true);
-                
+
+                Results javaResults = perf.testJava(),
+                        interpretedResults = perf.testExpression(false),
+                        compiledResults = perf.testExpression(true);
+
                 if (!output)
                     return;
-                
-                System.out.println(perf.getName() + ": " + perf.getExpression().toString());
+
+                System.out.println((compiledResults.mvel ? "MVEL" : "OGNL") + " " + perf.getName() + ": " + perf.getExpression().toString());
                 System.out.println("       java: " + javaResults.iterations + " iterations in " + javaResults.time + " ms");
-                
+
                 System.out.println("   compiled: " + compiledResults.iterations + " iterations in "
-                                + compiledResults.time + " ms ("
-                                + compiledResults.getFactor(javaResults) + "java)");
-                
+                                   + compiledResults.time + " ms ("
+                                   + compiledResults.getFactor(javaResults) + "java)");
+
                 System.out.println("interpreted: " + interpretedResults.iterations + " iterations in "
-                        + interpretedResults.time + " ms ("
-                        + interpretedResults.getFactor(javaResults) + "java)");
-                
+                                   + interpretedResults.time + " ms ("
+                                   + interpretedResults.getFactor(javaResults) + "java)");
+
                 System.out.println();
-                
+
             } catch (OgnlException ex) {
                 ex.printStackTrace();
             }
         }
     }
-    
+
     /*
-     * =================================================================== Constructors
-     * ===================================================================
-     */
+    * =================================================================== Constructors
+    * ===================================================================
+    */
     public Performance(String name, String expressionString, String javaMethodName)
-        throws Exception
+            throws Exception
     {
-        super();
-        this.name = name;
-        
-        expression = (SimpleNode) Ognl.parseExpression(expressionString);
-        compiledExpression = (SimpleNode) Ognl.compileExpression(context, root, expressionString);
+        this(name, expressionString, javaMethodName, false);
+    }
+
+    public Performance(String name, String expressionString, String javaMethodName, boolean mvel)
+            throws Exception
+    {
+        _name = name;
+        _isMvel = mvel;
+        _expressionString = expressionString;
+
         try {
-            method = getClass().getMethod(javaMethodName, new Class[] {});
+            _method = getClass().getMethod(javaMethodName, new Class[] {});
         } catch (Exception ex) {
             throw new OgnlException("java method not found", ex);
         }
-        
-        Ognl.getValue(expression, context, root);
-        
-        //if (expression.getAccessor() == null)
-          //  _compiler.compileExpression(context, expression, root);
-        
-        context.put("contextValue", "cvalue");
+
+        if (!_isMvel)
+        {
+            _expression = (SimpleNode) Ognl.parseExpression(expressionString);
+            _compiledExpression = (SimpleNode) Ognl.compileExpression(_context, _root, expressionString);
+            Ognl.getValue(_expression, _context, _root);
+            _context.put("contextValue", "cvalue");
+        } else
+        {
+            _mvelCompiled = MVEL.compileExpression(expressionString);
+        }
     }
 
     /*
      */
     protected void startTest()
     {
-        iterations = 0;
+        _iterations = 0;
         t0 = t1 = System.currentTimeMillis();
     }
 
     protected Results endTest()
     {
-        return new Results(iterations, t1 - t0);
+        return new Results(_iterations, t1 - t0, _isMvel);
     }
 
     protected boolean done()
     {
-        iterations++;
+        _iterations++;
         t1 = System.currentTimeMillis();
 
         if (TIME_MODE) {
             return (t1 - t0) >= MAX_TIME;
         } else {
             if (ITERATIONS_MODE) {
-                return iterations >= MAX_ITERATIONS;
+                return _iterations >= MAX_ITERATIONS;
             } else {
                 throw new RuntimeException("no maximums specified");
             }
      */
     public String getName()
     {
-        return name;
+        return _name;
     }
 
-    public SimpleNode getExpression()
+    public String getExpression()
     {
-        return expression;
+        return _expressionString;
     }
-    
+
     public Results testExpression(boolean compiled)
-        throws Exception
+            throws Exception
     {
         startTest();
         do {
-            if (compiled)
-                Ognl.getValue(compiledExpression.getAccessor(), context, root);
-            else
-                Ognl.getValue(expression, context, root);
+            if (!_isMvel)
+            {
+                if (compiled)
+                    Ognl.getValue(_compiledExpression.getAccessor(), _context, _root);
+                else
+                    Ognl.getValue(_expression, _context, _root);
+            } else
+            {
+                if (compiled)
+                    MVEL.executeExpression(_mvelCompiled, _root);
+                else
+                    MVEL.eval(_expressionString, _root);
+            }
         } while(!done());
         return endTest();
     }
 
     public Results testJava()
-        throws OgnlException
+            throws OgnlException
     {
         try {
-            return (Results) method.invoke(this, new Object[] {});
+            return (Results) _method.invoke(this, new Object[] {});
         } catch (Exception ex) {
-            throw new OgnlException("invoking java method '" + method.getName() + "'", ex);
+            throw new OgnlException("invoking java method '" + _method.getName() + "'", ex);
         }
     }
 
     public Results testConstantExpression()
-        throws OgnlException
+            throws OgnlException
     {
         startTest();
         do {
     }
 
     public Results testSinglePropertyExpression()
-        throws OgnlException
+            throws OgnlException
     {
         startTest();
         do {
-            root.getBean2();
+            _root.getBean2();
         } while(!done());
         return endTest();
     }
 
     public Results testPropertyNavigationExpression()
-        throws OgnlException
+            throws OgnlException
     {
         startTest();
         do {
-            root.getBean2().getBean3().getValue();
+            _root.getBean2().getBean3().getValue();
         } while(!done());
         return endTest();
     }
-    
+
     public Results testPropertyNavigationSetting()
-    throws OgnlException
+            throws OgnlException
     {
         startTest();
         do {
-            root.getBean2().getBean3().setNullValue("a value");
+            _root.getBean2().getBean3().setNullValue("a value");
         } while(!done());
         return endTest();
     }
-    
+
     public Results testPropertyNavigationAndComparisonExpression()
-        throws OgnlException
+            throws OgnlException
     {
         startTest();
         do {
-            boolean result = root.getBean2().getBean3().getValue() < 24;
+            boolean result = _root.getBean2().getBean3().getValue() < 24;
         } while(!done());
         return endTest();
     }
 
     public Results testIndexedPropertyNavigationExpression()
-        throws OgnlException
+            throws OgnlException
     {
         startTest();
         do {
-            root.getBean2().getBean3().getIndexedValue(25);
+            _root.getBean2().getBean3().getIndexedValue(25);
         } while(!done());
         return endTest();
     }
-    
+
     public Results testPropertyNavigationWithMapSetting()
-    throws OgnlException
+            throws OgnlException
     {
         startTest();
         do {
-            root.getBean2().getBean3().getMap().put("bam", "bam");
+            _root.getBean2().getBean3().getMap().put("bam", "bam");
         } while(!done());
         return endTest();
     }
-    
+
     public Results testPropertyNavigationWithMapExpression()
-        throws OgnlException
+            throws OgnlException
     {
         startTest();
         do {
-            root.getBean2().getBean3().getMap().get("foo");
+            _root.getBean2().getBean3().getMap().get("foo");
         } while(!done());
         return endTest();
     }