I made some benchmarks and the conclusion is that there is a
difference.
Using the regexp filter, the small resources are served by Tomcat for
free (0 ms) on my laptop. Without the regexp it costs a minimum of 15
ms. It's not that much but if you webapp contains lots of resources
it's noticeable.
Here, the comparison beetween 2 runs of 5 load of this page :
http://www.mon-credit-immobilier.info/simulation-ptz without the
browser cache.
For each page loading, the persistence filter manage 26 requests more
(it's not that much with the cache). The total difference is one
second for 5 pages.
<?xml version="1.0" encoding="ISO-8859-1"?>
<tree type="Call tree comparison" threadSelection="All threads"
threadStatus="Runnable" aggregation="Packages"
differenceCalculation="Total call times">
<node leaf="false" package="
org.apache.tomcat.util.net"
timeDelta="-165921" timeBase="2705005" countDelta="0" countBase="6">
<node leaf="false" package="com.google.inject.servlet"
timeDelta="-163760" timeBase="2313286" countDelta="0" countBase="110">
<node leaf="true" package="java.util.regex" timeDelta="43284"
timeBase="0" countDelta="220" countBase="0"/>
<node leaf="true" package="java.util" timeDelta="613"
timeBase="778" countDelta="210" countBase="330"/>
<node leaf="true" package="javax.servlet.http" timeDelta="520"
timeBase="542" countDelta="105" countBase="220"/>
<node leaf="true" package="java.util.concurrent.atomic"
timeDelta="-5" timeBase="161" countDelta="0" countBase="110"/>
<node leaf="true" package="java.lang" timeDelta="-838"
timeBase="2398" countDelta="-5" countBase="660"/>
<node leaf="false" package="javax.servlet" timeDelta="-208069"
timeBase="2294866" countDelta="0" countBase="110">
<node leaf="true" package="com.coach.web" timeDelta="62341"
timeBase="0" countDelta="115" countBase="0"/>
<node leaf="true" package="com.google.inject.servlet"
timeDelta="55059" timeBase="0" countDelta="105" countBase="0"/>
<node leaf="true" package="org.slf4j.impl" timeDelta="20363"
timeBase="0" countDelta="200" countBase="0"/>
<node leaf="false" package="com.wideplay.warp.persist"
timeDelta="-1021980" timeBase="2294556" countDelta="-105"
countBase="110">
<node leaf="true" package="java.util" timeDelta="-110"
timeBase="125" countDelta="-105" countBase="110"/>
<node leaf="true" package="java.lang" timeDelta="-111"
timeBase="125" countDelta="-105" countBase="110"/>
<node leaf="true" package="java.util.concurrent.locks"
timeDelta="-2801" timeBase="2941" countDelta="-420" countBase="440"/>
<node leaf="false"
package="com.wideplay.warp.persist.internal" timeDelta="-1017643"
timeBase="2289679" countDelta="-105" countBase="110">
<node leaf="true" package="java.lang" timeDelta="-466"
timeBase="484" countDelta="-210" countBase="220"/>
<node leaf="true" package="java.util" timeDelta="-1364"
timeBase="1426" countDelta="-630" countBase="660"/>
<node leaf="false" package="com.wideplay.warp.persist"
timeDelta="-1010558" timeBase="2282336" countDelta="-315"
countBase="330">
<node leaf="false"
package="com.wideplay.warp.persist.jpa" timeDelta="-170558"
timeBase="178050" countDelta="-210" countBase="220"/>
<node leaf="false" package="javax.servlet"
timeDelta="-834240" timeBase="2098338" countDelta="-105"
countBase="110">
<node leaf="false" package="com.google.inject.servlet"
timeDelta="-833808" timeBase="2097877" countDelta="-105"
countBase="110">
<node leaf="true"
package="java.util.concurrent.atomic" timeDelta="71" timeBase="141"
countDelta="-105" countBase="110"/>
<node leaf="true" package="java.lang"
timeDelta="-143" timeBase="160" countDelta="-105" countBase="110"/>
<node leaf="true" package="java.util"
timeDelta="-300" timeBase="338" countDelta="-210" countBase="220"/>
<node leaf="true" package="javax.servlet.http"
timeDelta="-337" timeBase="363" countDelta="-105" countBase="110"/>
<node leaf="false" package="javax.servlet"
timeDelta="-829048" timeBase="2092625" countDelta="-105"
countBase="110"/>
</node>
</node>
</node>
</node>
</node>
</node>
</node>
</node>
</tree>
On 19 juil, 13:02, "Dhanji R. Prasanna" <
dha...@gmail.com> wrote:
> I'll wager that EntityManager creation cost is negligible in any decent JPA
> implementation. My point is more about the fact that maintaining this regex
> is an unnecessary complexity.
>
> If you can demonstrate that there is a serious performance hit I'll take it
> seriously =)
>
> Dhanji.
>