PDA

View Full Version : Regular string Variables vs XML Variables


kaztor
06-20-2009, 01:21 AM
I'm trying to figure out which is more efficient in terms of memory and speed. What I'm doing is having a series of messages loaded to the screen. Is it just faster to write them in string variable or in an XML document which is more versatile in terms of editing and adding on to the document.
Thx for the help.

DukeW
06-20-2009, 11:53 AM
I'm not sure, which is faster, but here's how you can set up a test.
Set up an xml, and a text file with the same volume of data, then make a for loop that simply reads them and assigns them to a variable, make it repeat for about 1000 times.
Before your code place var testVar:int= getTimer(); and after it place trace(String(tempVar-getTimer())); .
This will trace the time in milliseconds it took to run your code. Compare the 2 results, and you have your answer.
If you manage to do the test, please share the result, it would be nice to know.