Hi,
today I was tracking down a performance problem in some code that created tons
of FeaturesTypes and FeatureAttributesTypes and found out most of the time was
spent
creating filters.
The profile looks more or less like like (the first number is a time in
milliseconds):
263 514 (100%, 2 other callers)
org.geotools.feature.AttributeTypeFactory.newAttributeType
263 514 (100%, 1 other caller)
org.geotools.feature.DefaultAttributeTypeFactory.createAttributeType
261 597 (100%) org.geotools.feature.DefaultAttributeTypeFactory.length
261 260 (100%)
org.geotools.filter.FilterFactoryImpl.createFunctionExpression
218 886 (100%) org.geotools.factory.FactoryFinder$1.next
40 627 (100%, 1 other caller)
org.geotools.factory.FactoryFinder.factories
970 (99%, 2 other callers) java.lang.String.toLowerCase
329 (100%) java.lang.String.replaceFirst
120 (30%, 4 other callers) java.lang.String.equalsIgnoreCase
109 (100%) org.geotools.filter.CompareFilterImpl.addLeftValue
54 (100%) org.geotools.filter.FilterFactoryImpl.createCompareFilter
54 (100%)
org.geotools.filter.FilterFactoryImpl.createLiteralExpression
1 830 (82%, 5 other callers) java.lang.Class.isAssignableFrom
588 (47%, 4 other callers) java.util.HashMap.get
So, my app spent more or less 264 seconds creating attribute types... The scary
thing is that all of the time was spend searching again and again in the
classpath
for functions (in particular, for the "LenghtFunction"), and that's very, very
slow.
Now, can't we cache somehow the functions and clone them instead of searching
like
crazy in the classpath again and again?
The only problem is that FunctionExpression is not cloneable, and we have to
return a
new instance of the function at every call...
Cheers
Andrea
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel