World Wind Forums

Go Back   World Wind Forums > WorldWind JAVA forums > Development Help

Development Help Help for building applications or diagnosing problems with WWJ

Reply
 
Thread Tools Display Modes
Old 07-25-2007, 03:11 PM   #1
vash
Senior Member
 
Join Date: May 2007
Location: Toulouse
Posts: 120
vash is on a distinguished road
Default Performance problem on new WMS Capabilities document parser

I've noticed a sensible lack of performance on the WMS capabilities parser, it takes 5 mn to parse my local server capabilities. I've read the code and i think it could be optimized, it do around 1000 xpath request on the document to parse. The biggest problem is that each getter on a field of the document do a xpath.

example :

Code:
    public String getVersion()
    {
        return this.getText("*/@wms:version");
    }
a better design could be :
Code:
    private String version= null;
    
    public String getVersion()
    {
    	if (version== null) {
    		version= this.getText("*/@wms:version");
    	}
        return version;
    }
I'm refactoring the parser to see if this design improve performance. A sax parser instead of DOM/Xpath would also be a good solution to improve performance.


What do you think about this, Tag?
__________________
-Nicolas CASTEL- Thales Alenia Space, Toulouse, France-

Last edited by vash; 07-25-2007 at 03:16 PM.
vash is offline   Reply With Quote
Old 07-26-2007, 12:41 PM   #2
vash
Senior Member
 
Join Date: May 2007
Location: Toulouse
Posts: 120
vash is on a distinguished road
Default

I've finished the redesign. The redesigned parser spent 10s to parse the same file vs 5 mn for the original parser.

http://nicastel.free.fr/worldwind/wms_cap_parser.zip
__________________
-Nicolas CASTEL- Thales Alenia Space, Toulouse, France-

Last edited by vash; 07-26-2007 at 12:48 PM.
vash is offline   Reply With Quote
Old 07-27-2007, 01:38 AM   #3
tag
WWJ Technical Manager
 
Join Date: May 2007
Location: Seattle
Posts: 1,031
tag is on a distinguished road
Default

Thanks! What'd you do?
tag is offline   Reply With Quote
Old 07-27-2007, 08:46 AM   #4
vash
Senior Member
 
Join Date: May 2007
Location: Toulouse
Posts: 120
vash is on a distinguished road
Default

Quote:
Originally Posted by tag View Post
Thanks! What'd you do?
I've applied the pattern explained in my first post on all the methods of Capabalities and derived classes.

For the method which takes an element in parameter such as the Layer Items methods, i've created a inner class which contains all the fields necessary and wrap an element, and i've redesigned the methods associed.

example :

Code:
    public String getLayerAbstract(Element layer)
    {
    		return this.getText(element, "wms:Abstract");
    }
becomes

Code:
    public class LayerElement {
    	public Element element;
    	
    	public String layerAbstract = null;
    	public String layerAttributionTitle = null;
    	public String layerAttributionURL = null;
    	public String layerAttributionLogoFormat = null;    	
    	public String layerAttributionLogoHeight = null;
    	public String layerAttributionLogoURL = null;
    	public String layerAttributionLogoWidth = null;
    	public MetadataElement[] layerAuthorityURLs = null;
   	    public BoundingBox[] layerBoundingBoxes = null;
   	    public String layerCascaded = null;
   	    public String[] layerCRS = null;
   	    public String layerDataURLFormat = null;
   	    public String layerDataURL = null;
   	    public DimensionElement[] layerDimensions = null;
   	    public DimensionElement[] layerExtents = null;
   	    public BoundingBox layerGeographicBoundingBox = null;
   	    public String layerFeatureListFormat = null;
   	    public String layerFeatureListURL = null;
   	    public String layerFixedHeight = null;
   	    public String layerFixedWidth = null;
   	    public IdentifierElement[] layerIdentifiers = null;
   	    public String[] layerKeywordList = null;
   	    public String layerMaxScaleDenominator = null;
   	    public MetadataElement[] layerMetadataURLs = null;
   	    public String layerMinScaleDenominator = null;
    	public String layerName = null;
    	public String layerNoSubsets = null;
    	public String layerOpaque = null;
    	public String layerQueryable = null;
    	public String[] layerSRS = null;
   	    public StyleElement[] layerStyles = null;
    	public LayerElement[] layerSubLayers = null;
    	public String layerTitle = null;
    	
    	public LayerElement(Element element) {
    		this.element = element;
    	}
    }
    
    public String getLayerAbstract(LayerElement layer)
    {
    	if (layer.layerAbstract == null) {
    		layer.layerAbstract = this.getText(layer.element, "wms:Abstract");
    	}
        return layer.layerAbstract;
    }
With this design only the fields needed by the client are accessed with xpath and only one time for each field.
__________________
-Nicolas CASTEL- Thales Alenia Space, Toulouse, France-
vash is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
WMS Browser Problem armin Technical Support 1 03-20-2007 04:41 PM
WMS Server Conncection Problem mjd Technical Support 3 01-24-2007 12:28 AM
slight performance problem after patching to 1.31 Guest_max_* Technical Support 2 04-03-2005 02:45 PM


All times are GMT +1. The time now is 02:30 PM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.