By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,983 Members | 2,082 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,983 IT Pros & Developers. It's quick & easy.

XML vs. SQL

ujdave
P: 3
Hi everyone!

First of all this is not an "I've got a huge ERROR, plz help me to solve it" post, but a "What do you think which is better for this EXACT JOB?" post.

So, I work on an application and (see a miracle) I have a couple data and now I'm wondering how to store this informations. The data perfectly suits to XML data structure, and php has a pretty good xml tool, called SimpleXml, BUT...
I can't delete with it, so I must use DOM for this, which is a "bit" slower. Now, performance is a very important part of this app, and since I don't know DOM very well, I'm not sure that XML would be the best for me. Actually the XML DOM would NOT be bigger, than maximum a couple hundred elements, but I modify them a lot, so... I don't know.
I would be happy to use XML, but I want the fastest way.

I hope there is someone much more experienced out there than me...
If there is.... plz help me to decide! :)

thnx a million!
Dave
Dec 31 '07 #1
Share this Question
Share on Google+
5 Replies


pbmods
Expert 5K+
P: 5,821
Heya, Dave. Welcome to TSDN!

What's the nature of the beast? Are you communicating with an external server? Storing form values? Caching data from a database?
Dec 31 '07 #2

ujdave
P: 3
Heya, Dave. Welcome to TSDN!

What's the nature of the beast? Are you communicating with an external server? Storing form values? Caching data from a database?
Hi!

1 I'm not communicating with external server.
2 True. :) Some personal and not so personal datas.
3 On this level of the "Beast" I'm not communicating with database...

User login -> Database
Changing a couple stored data -> Db vs Xml

:) That's it!
Jan 1 '08 #3

pbmods
Expert 5K+
P: 5,821
Heya, Dave.

You are looking at whether it makes more sense to store the form values in an XML file versus storing them in a database. Is that correct?
Jan 1 '08 #4

ujdave
P: 3
Hi!

Erm.... Yea and Nope! :)
So, I know that in this case Xml would be the best 4me, but I do not want to slow down my application.
So the question is:

Is Php's DOM XML function fast enough (I've heard that sometimes it can be terribly slow) or I must use SQL if I want a fast app?

Which is faster?

I know, with one user, the difference can be irrelevant, but with a couple thousand? :)

thnx 4 ur time!
Jan 2 '08 #5

pbmods
Expert 5K+
P: 5,821
Heya, Dave.

Hm. That's an interesting question.

My recommendation would be to try it out. Set up a couple of for loops to run the operation you want to test a few hundred thousand times and then output the amount of time it took:

Expand|Select|Wrap|Line Numbers
  1. echo 'Testing xyz...';
  2. $start = microtime(true);
  3.  
  4. for( $i = 0; $i < 100000; ++$i )
  5. {
  6.     // Do stuff here.
  7. }
  8.  
  9. echo 'DONE ', (microtime(true) - $start), ' seconds<br />';
  10.  
Jan 2 '08 #6

Post your reply

Sign in to post your reply or Sign up for a free account.