jboss rules3.1m终于用了一个el:mvel,性能与ognl的对比有些让人吃惊

阅读更多
引用

Later I will also move templates from StringTemplate to MVEL, our template use is minimal so we don't really care what we use. MVEL is a needed dependency and already provides templates, so we might as well use that. The added bonus is that StringTemplate still relies on antlr-2.7.7, so I'll be able to remove 2 more dependencies.

按照这个本意仅仅是想减少两个包的依赖..丝毫不提mvel的优越性能啊,我倒看中这一点,目前项目中的规则运算巨慢,不过主要原因是hibernate查询导致的...

下面是性能对比:
http://mvel.codehaus.org/Performance+of+MVEL
===============================================
Test Platform        : Java 2 Standard Edition v1.6.0 final
Machine Spec.        : Intel Core Duo T2600 1.66Ghz / 2GB DDR2 533Mhz RAM / Windows Vista RTM
VM Options           : <>
MVEL Build           : 1.2.0 Beta11 w/JIT
OGNL Build           : 2.6.11 Stable
===============================================

Test Name            : Simple String Pass-Through
Expression           : 'Hello World'
Iterations           : 50000
Interpreted Results  :
(OGNL)               : 1344.20ms avg.  (mem delta: -789kb) [1424,1393,1299,1302,1302]
(MVEL)               : 21.80ms avg.  (mem delta: -93kb) [22,21,22,21,23]
Compiled Results     :
(OGNL Compiled)      : 10.00ms avg.  (mem delta: -562kb) [14,9,8,10,9]
(MVEL Compiled)      : 0.60ms avg.  (mem delta: -18kb) [1,0,1,0,1]
------------------------------------------------
Test Name            : Shallow Property
Expression           : data
Iterations           : 50000
Interpreted Results  :
(OGNL)               : 1591.20ms avg.  (mem delta: -782kb) [1594,1603,1590,1588,1581]
(MVEL)               : 49.40ms avg.  (mem delta: -712kb) [49,51,49,49,49]
Compiled Results     :
(OGNL Compiled)      : 34.80ms avg.  (mem delta: -636kb) [35,34,34,36,35]
(MVEL Compiled)      : 1.80ms avg.  (mem delta: -18kb) [2,2,2,2,1]
------------------------------------------------
Test Name            : Deep Property
Expression           : foo.bar.name
Iterations           : 50000
Interpreted Results  :
(OGNL)               : 1955.20ms avg.  (mem delta: -790kb) [1936,1949,1943,1994,1954]
(MVEL)               : 114.80ms avg.  (mem delta: -112kb) [119,113,110,117,115]
Compiled Results     :
(OGNL Compiled)      : 92.80ms avg.  (mem delta: -580kb) [92,92,92,92,96]
(MVEL Compiled)      : 1.80ms avg.  (mem delta: -18kb) [1,2,2,2,2]
------------------------------------------------
Test Name            : Static Field Access (MVEL)
Expression           : Integer.MAX_VALUE
Iterations           : 50000
Interpreted Results  :
(MVEL)               : 90.00ms avg.  (mem delta: -658kb) [88,95,108,80,79]
Compiled Results     :
(MVEL Compiled)      : 2.40ms avg.  (mem delta: -337kb) [4,2,2,2,2]
------------------------------------------------
Test Name            : Static Field Access (OGNL)
Expression           : @java.lang.Integer@MAX_VALUE
Iterations           : 50000
Interpreted Results  :
(OGNL)               : 2036.20ms avg.  (mem delta: -791kb) [2119,2039,2118,1946,1959]
Compiled Results     :
(OGNL Compiled)      : 10.00ms avg.  (mem delta: -580kb) [13,9,9,10,9]
------------------------------------------------
Test Name            : Inline Array Creation (MVEL)
Expression           : {'foo', 'bar'}
Iterations           : 50000
Interpreted Results  :
(MVEL)               : 229.40ms avg.  (mem delta: -430kb) [217,217,230,247,236]
Compiled Results     :
(MVEL Compiled)      : 4.00ms avg.  (mem delta: -504kb) [5,3,4,4,4]
------------------------------------------------
Test Name            : Inline Array Creation (OGNL)
Expression           : new String[] {'foo', 'bar'}
Iterations           : 50000
Interpreted Results  :
(OGNL)               : 1824.80ms avg.  (mem delta: -845kb) [1847,1802,1828,1816,1831]
Compiled Results     :
(OGNL Compiled)      : 62.20ms avg.  (mem delta: -449kb) [63,64,62,62,60]
------------------------------------------------
Test Name            : Collection Access + Method Call
Expression           : funMap['foo'].happy()
Iterations           : 50000
Interpreted Results  :
(OGNL)               : 1968.20ms avg.  (mem delta: -788kb) [1959,1953,1949,2021,1959]
(MVEL)               : 114.40ms avg.  (mem delta: -150kb) [116,114,116,112,114]
Compiled Results     :
(OGNL Compiled)      : 112.80ms avg.  (mem delta: -636kb) [116,111,113,112,112]
(MVEL Compiled)      : 2.20ms avg.  (mem delta: -18kb) [3,2,2,2,2]
------------------------------------------------
Test Name            : Boolean compare
Expression           : data == 'cat'
Iterations           : 50000
Interpreted Results  :
(OGNL)               : 1623.20ms avg.  (mem delta: -782kb) [1620,1629,1624,1620,1623]
(MVEL)               : 99.40ms avg.  (mem delta: -673kb) [107,98,99,96,97]
Compiled Results     :
(OGNL Compiled)      : 54.40ms avg.  (mem delta: -541kb) [54,54,57,53,54]
(MVEL Compiled)      : 15.60ms avg.  (mem delta: -747kb) [16,15,16,16,15]
------------------------------------------------
Test Name            : Object instantiation
Expression           : new String('Hello')
Iterations           : 50000
Interpreted Results  :
(OGNL)               : 1864.40ms avg.  (mem delta: -784kb) [1872,1867,1870,1855,1858]
(MVEL)               : 236.00ms avg.  (mem delta: -450kb) [238,234,236,236,236]
Compiled Results     :
(OGNL Compiled)      : 193.00ms avg.  (mem delta: -449kb) [196,191,191,196,191]
(MVEL Compiled)      : 2.80ms avg.  (mem delta: -507kb) [3,3,3,2,3]
------------------------------------------------
Test Name            : Method access
Expression           : readBack('this is a string')
Iterations           : 50000
Interpreted Results  :
(OGNL)               : 1791.80ms avg.  (mem delta: -786kb) [1771,1775,1781,1814,1818]
(MVEL)               : 107.60ms avg.  (mem delta: -506kb) [109,108,108,106,107]
Compiled Results     :
(OGNL Compiled)      : 70.60ms avg.  (mem delta: -598kb) [69,73,71,71,69]
(MVEL Compiled)      : 2.40ms avg.  (mem delta: -18kb) [2,3,2,2,3]
------------------------------------------------
Test Name            : Arithmetic
Expression           : 10 + 1 - 1
Iterations           : 50000
Interpreted Results  :
(OGNL)               : 1812.00ms avg.  (mem delta: -371kb) [1853,1821,1798,1792,1796]
(MVEL)               : 108.40ms avg.  (mem delta: -620kb) [112,108,109,107,106]
Compiled Results     :
(OGNL Compiled)      : 9.40ms avg.  (mem delta: -580kb) [10,9,10,9,9]
(MVEL Compiled)      : 0.60ms avg.  (mem delta: -18kb) [1,0,1,0,1]
------------------------------------------------

你可能感兴趣的:(JBoss,Hibernate,Google,Access,Webwork)