roa Posted March 20, 2018 Report Posted March 20, 2018 Hi, I use the data from runways.xml in a new app I am developing. In order to reduce the load time of the xml file, I wonder if there is any possiblity to specify the elements that should be listed in the runways.xml output from Makerunway.exe? Instead of the all elements + their values in the default runways.xml as seen in List 1 I need only the elements + values shown in List 2. If a reduced output as in List 2 was possible, load time of runways.xml would be much reduced as there are more than 24000 airports in P3Dv4. The example ICAO shows one runway, but I need all the same elements + value for all runways under an ICAO. List 1 <ICAO id="00AL"> <ICAOName>Epps Airpark</ICAOName> <Country>United States</Country> <State>Alabama</State> <City>Harvest</City> <File>Scenery\0302\scenery\APX24190.bgl</File> <SceneryName>0302 Base</SceneryName> <Longitude>-86.770279</Longitude> <Latitude>34.864811</Latitude> <Altitude>820</Altitude> <MagVar>0.000</MagVar> <Runway id="01"> <Len>2300</Len> <Hdg>10.000</Hdg> <Def>Grass</Def> <ILSFreq></ILSFreq> <ILSHdg></ILSHdg> <ILSid></ILSid> <ILSslope>0.00</ILSslope> <Lat>34.861698</Lat> <Lon>-86.770950</Lon> <FSStartLat>34.861805</FSStartLat> <FSStartLon>-86.770920</FSStartLon> <ClosedLanding>FALSE</ClosedLanding> <ClosedTakeoff>FALSE</ClosedTakeoff> <ApproachLights>NONE</ApproachLights> <EdgeLights>NONE</EdgeLights> <CenterLights>NONE</CenterLights> <CenterRed>FALSE</CenterRed> <EndLights>FALSE</EndLights> <REIL>FALSE</REIL> <Touchdown>FALSE</Touchdown> <Strobes>0</Strobes> <LeftVASI>NONE</LeftVASI> <RightVASI>NONE</RightVASI> <ThresholdOffset>0</ThresholdOffset> <PatternTakeOff>Left</PatternTakeOff> <PatternLanding>Left</PatternLanding> <PatternAltitude>305</PatternAltitude> </Runway> </ICAO> List 2 <ICAO id="00AL"> <ICAOName>Epps Airpark</ICAOName> <Country>United States</Country> <State>Alabama</State> <City>Harvest</City> <Altitude>820</Altitude> <MagVar>0.000</MagVar> <Runway id="01"> <Hdg>10.000</Hdg> <FSStartLat>34.861805</FSStartLat> <FSStartLon>-86.770920</FSStartLon> </Runway> </ICAO>
Pete Dowson Posted March 20, 2018 Report Posted March 20, 2018 14 minutes ago, roa said: In order to reduce the load time of the xml file, I wonder if there is any possiblity to specify the elements that should be listed in the runways.xml output from Makerunway.exe? Loading time? How often do you have to load it? It should be negligible in any case. And if you mean processing time, surely one of the benefits of the tags is that you can pick and choose what you want to actually extract. If it is too much trouble, why not instead use one of the other formts, the CSVs or even the binary file. Sorry, but I really don't think such a change is justified. Pete
roa Posted March 20, 2018 Author Report Posted March 20, 2018 I only load it once when the app is started. But, it takes around 10 secs as I load it 2 times now, once to an Xdocuments and once to a Dataset, but I would like to reduce it at most 1-2 secs. I need to use the XML format because I am using LINQ to XML queries in the app code. Maybe I can reduce load time if I am able to convert XDocument structure to Dataset.
Pete Dowson Posted March 21, 2018 Report Posted March 21, 2018 18 minutes ago, roa said: I only load it once when the app is started. But, it takes around 10 secs as I load it 2 times now, once to an Xdocuments and once to a Dataset, but I would like to reduce it at most 1-2 secs. The file only changes when you add or update airports. So why not process it once yourself and do what you wish with the data? Pete P.S. I can't really believe it takes as long as 10 seconds to load in any case. And once it is loaded once it will be cached for quite a while. I have over 600 scenery layers and the data tends to be more extensive, but even Makerunways only takes about 20 seconds when generating all the files, and there's a lot of those! If you are processing whilst you load, don't! Load it then process in memory.
Paul Henty Posted March 21, 2018 Report Posted March 21, 2018 Quote But, it takes around 10 secs as I load it 2 times now, once to an Xdocuments and once to a Dataset, 10 seconds is a long time to read that file. If you are using my .NET Client DLL see the latest version (3.1) post in my sub forum. If you use the new AirportsDatabase feature it will save you a lot of coding and loading the database into memory takes about 2 seconds. The database it just a collection in memory, so if you need to get it into a dataset you'll have to transfer the data from the AirportsDatabase with your own code. If you're not using my DLL, here's the testing I did for the different ways of reading the runways.xml File: XMLTextReader: 24490 Airports in 674 ms XDocument: 24490 Airports in 1,254 ms XMLDocument: 24490 Airports in 16,275 ms Manual Read: 24490 Airports in 937 ms If you only need to read the file from top to bottom then XMLTextReader is about twice as fast as XDocument. But even using XDocument only takes just over a second for me. XMLTextReader will require writing a lot more code though. I also added code to create rows in a data table and that didn't add any significant time. XMLTextReader + Create Table Rows: 24490 Airports in 727 ms This test code just finds all the airports from the file, so this is just the time taken to read through the file. There's no other processing. In my DLL I read a lot of the data into an in-memory collection and it takes about 2 seconds with all the string parsing to numbers etc. Paul 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now