Pages: [1] :: one page |
|
Author |
Thread Statistics | Show CCP posts - 0 post(s) |
Xeron Rich
|
Posted - 2009.12.23 00:36:00 -
[1]
I'm writing my own API library in vb.net for use in WPF applications. My program is running awfully slow... just to retrieve and handle /account/Characters.xml.aspx is taking about 17 seconds. It takes 3 if the information is already cached.
Is this normal? Slow?
The only thing I can think of that might slow it down is I'm using XMLTextReader.Read() to get past each line in the XML file.
I'm going to look into alternative ways of navigating the file later, but I thought I would post now so maybe someone confirm whether or not I have a problem.
|
Dragonaire
Caldari Corax. New Eden Retail Federation
|
Posted - 2009.12.23 05:44:00 -
[2]
I would say reading it line by line would be slower then something that grabs the whole thing and than you parser it 'offline'. Most of the APIs seem to only take a couple seconds to grab using PHP like I do in Yapeal but it's mostly dependent on connection speed you have to the Internet. A 28k dial-up is going to be much slower then 20MBps cable connection for example -- Finds camping stations from the inside much easier. Designer of Yapeal for Eve API.
|
Xeron Rich
|
Posted - 2009.12.23 07:43:00 -
[3]
Edited by: Xeron Rich on 23/12/2009 07:43:30 yea I was thinking storing the file then reading it would work better. i'm just learning xml manipulation, so I wasn't sure if that would be faster. guess i'll give that a try and see what results.
|
Vessper
SI Radio
|
Posted - 2009.12.23 07:47:00 -
[4]
Something doesn't seem quite right with those numbers. I'm using VB.net also and with my API system, I can download and fully parse all the information for 9 accounts in around 15 seconds. That's 9 x Characters.xml, 23 x CharacterSheet.xml and 23 x SkillQueue.xml.
What's the API download speed like when using any other API applications?
EveHQ Character App |
Xeron Rich
|
Posted - 2009.12.23 09:32:00 -
[5]
Edited by: Xeron Rich on 23/12/2009 09:33:19 here is my code for the function. i haven't removed all the xmltextreader.read()'s yet, but I did save the file locally & i'm still getting ridiculous load times.
Public Function Characters() As String
Dim Characters_apiKey As String = "apikey code" Dim Characters_userID As String = "userid number"
Dim Characters_uri As String = "http://api.eve-online.com/account/Characters.xml.aspx?userID=" & Characters_userID & "&apikey=" & Characters_apiKey
Dim xmlfile As String = Application_Path.ToString & "account\characters.xml" 'adds location of evening.exe to Dim xmlfile_check As New FileInfo(xmlfile)
If xmlfile_check.Exists Then xmlfile_check.Delete() End If
My.Computer.Network.DownloadFile(Characters_uri, xmlfile)
Dim reader As XmlTextReader reader = New XmlTextReader(xmlfile) reader.WhitespaceHandling = WhitespaceHandling.None Dim loopcount As Integer = 0
Dim charname As String = ""
While Not reader.EOF reader.Read() loopcount = loopcount + 1
If loopcount = 8 Then charname = reader.GetAttribute("name") 'Gets 1st character name Exit While End If End While
'1 = <?xml version... etc '2 = <eveapi version> '3 = <currenttime> '4 = "the current time" '5 = </currentitme> '6 = <result> '7 = <rowset name="characters" key="characterID" columns="name,characterID,corporationName,corporationID"> '8 = <row name="" characterID="" corporationName="" corporationID=""
reader.Close() 'closes XML file
Return charname End Function
|
Thart
U.K.R.A.I.N.E SOLAR FLEET
|
Posted - 2009.12.23 09:46:00 -
[6]
At the first you should find the part of code which works too long. Store time at the beginning, between load and parsing, at the end. Then calculate differences.
Nevertheless, I think problem is in Network.DownloadFile routine. In my tool I've used HttpWebRequest class to perform api requests. Works fine.
Are the other api based tools working quickly on your pc? May be problem in internet connection... ----------------------------------------- EVE Mentat - true trade tool. |
Xeron Rich
|
Posted - 2009.12.23 10:27:00 -
[7]
Edited by: Xeron Rich on 23/12/2009 10:27:45 Is there a way that I can start at specific line of the XML file?
Originally by: Thart At the first you should find the part of code which works too long. Store time at the beginning, between load and parsing, at the end. Then calculate differences.
Nevertheless, I think problem is in Network.DownloadFile routine. In my tool I've used HttpWebRequest class to perform api requests. Works fine.
Are the other api based tools working quickly on your pc? May be problem in internet connection...
Well the Network.DownloadFile was actually added after I noticed the slow loading problem. At first I was reading the file straight from the API server. I thought reading it locally would fix it (which I planned on doing at some point anyways) but it didn't help at all.
Also, I have a 8mb down, 512kb up internet connection, so there is definitely no problem downloading a xml file. EFT can load my character list in under a second.
Good call with the timers, I was hoping to avoid that though Then again, it wouldn't be something bad to have show anyways.
|
Thart
U.K.R.A.I.N.E SOLAR FLEET
|
Posted - 2009.12.23 10:42:00 -
[8]
Try to replace your xml reader with DOM reader - use XmlDocument class. ----------------------------------------- EVE Mentat - true trade tool. |
Xeron Rich
|
Posted - 2009.12.23 11:13:00 -
[9]
Edited by: Xeron Rich on 23/12/2009 11:14:47 Edited by: Xeron Rich on 23/12/2009 11:14:17
Originally by: Thart Try to replace your xml reader with DOM reader - use XmlDocument class.
Ty sir, that method is a lot quicker and gets my program down to around 2 seconds. I have pretty much all the basic code I need to pull any info from the API server quickly.
Now it's time for some code cleanup/commenting & GUI design :)
BTW, your market program is pretty sweet!
|
davcin
Caldari davcin Corp
|
Posted - 2009.12.23 11:27:00 -
[10]
If performance is not enough yet and you are doing a forward-only reading, you can also try XmlTextReader...
____________________________________________
EVEViewer - view your journal, orders, transactions and allot more out of |
|
Xeron Rich
|
Posted - 2009.12.23 11:29:00 -
[11]
that's actually what I was using before if you didn't notice my code. switching to XmlDocument proved to be faster.
|
davcin
Caldari davcin Corp
|
Posted - 2009.12.23 11:33:00 -
[12]
Edited by: davcin on 23/12/2009 11:33:09
Originally by: Xeron Rich that's actually what I was using before if you didn't notice my code. switching to XmlDocument proved to be faster.
Duh Have to start to read the post more carefully.
In my case the performance is pretty quick but i am reading from memory not from a file. (still, it let me thinking and will try with XmlDocument also to see the difference)
____________________________________________
EVEViewer - view your journal, orders, transactions and allot more out of |
Thart
U.K.R.A.I.N.E SOLAR FLEET
|
Posted - 2009.12.23 12:30:00 -
[13]
Originally by: Xeron Rich
Ty sir, that method is a lot quicker and gets my program down to around 2 seconds. I have pretty much all the basic code I need to pull any info from the API server quickly.
It's good! Also you can try to read xml from memory buffer, for instance from string, bypassing operations with HDD. It can speed up your code, as mentioned above.
Originally by: Xeron Rich BTW, your market program is pretty sweet!
Thanks ;) ----------------------------------------- EVE Mentat - true trade tool. |
Johnathan Roark
Caldari Quantum Industries Prime Orbital Systems
|
Posted - 2009.12.23 20:38:00 -
[14]
Originally by: Xeron Rich that's actually what I was using before if you didn't notice my code. switching to XmlDocument proved to be faster.
Biggest issue with XmlDocument will be memory usage. You may want to do some testing with the asset api to make sure you wont run into more issues.
Quantum Industries is recruiting! |
Xeron Rich
|
Posted - 2009.12.24 01:42:00 -
[15]
Edited by: Xeron Rich on 24/12/2009 01:42:30
Originally by: Johnathan Roark
Originally by: Xeron Rich that's actually what I was using before if you didn't notice my code. switching to XmlDocument proved to be faster.
Biggest issue with XmlDocument will be memory usage. You may want to do some testing with the asset api to make sure you wont run into more issues.
Ok thanks for the heads up, I will definitely keep that in mind. But I've run into another problem...
I'm writing the library in vb.net & using it in a WPF app using vb.net. I've been using visual studio 2010 to write this and I read in their documentation that XmlDataDocument (a subset of XmlDocument) is depreciated in .net 4.0. I planned on trying to use this to return datasets from my API functions rather than strings or arrays.
Link: http://msdn.microsoft.com/en-us/library/system.xml.xmldatadocument(VS.100).aspx
The question: What would be the best method to use instead? I would prefer not using an "obsolete" class. I suppose I could use XmlDocument and create a new array each time a node is read then insert the array into a dataset, but that just seem inefficient to me. I'm assuming there is a better/newer way if XmlDataDocument is being marked obsolete.
And sorry if this seems like a noob question, but I'm 100% self-taught with vb.net.
|
|
|
|
Pages: [1] :: one page |
First page | Previous page | Next page | Last page |