Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Speed with XML vs. variables

Status
Not open for further replies.

Craftor

Programmer
Feb 1, 2001
420
NZ
Hi all

I am currently writing quite a hectic ASP page - with quite a few database queries and queries of other sites. All the database queries are returned as XML, as are the queries of the sites.

Would it be faster to load all the information that I will need into individual variables, and pass them to my queries? Or would it be better to create one XML document, append the info returned into the document and then reference the elements I need?

e.g. say I have 4 fields: FirstName, Surname, Date, Email. FirstName & Surname are passed in an XML document to my query. I pass these two fields to a site and it returns me Date. I then pass all three fields to a SQL stored procedure and it returns Email. I now need to display all the fields on the page and save them to a databse.

This is obviously very simplified - just for example purposes so everyone can see what I am getting at.

Is it better for me to have 4 variables and load the info in them as needed? Or should I create an XML document and append these 4 variables as elements as and when I get them?

Thanks as always

Craftor

:cool:
 
That would depend on what your scalability needs are.

You're going to get better performance from the in-memory variables... just flat out speed.

However, that's only going to hold true up to a point. That point will be somewhere around the time your server runs out of memory, and starts putting those vars in virtual memory (give or take a nanosecond).

At that point, you will start losing performance gains over your xml model.

So, the question is: "How many simultaneous bits of information do I plan to hold in memory, and how does my server memory stack up against that number?"

Remember to keep in mind any other apps you have running on the server, or if it's a shared server, you can almost guarantee yourself that you'll get better performance from the xml method.

paul
penny1.gif
penny1.gif
 
Thanks Paul

If I stick everything I need into a variable, I'll be sitting on 60 variables (!!) so I guess I should go the XML route :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top