PV:
PV said:
Hi everyone,
I've heard some (I think wierd) ideas that it is much faster to use
XmlDocument then DataSet for storing and updateing data from database. The
idea is to use XmlDocument to store data, make add/update/delete operations
on it, keep track of changes and finally make changes into database. It
assumes that one have to write all methods that will perform these actions
on XmlDocument that will act as DataSet.
Does anyone has experience with this and what are real performace issues on
this?
PV
PV:
I think that there are many factors here that could affect performance so
it's not an either/or situation across the board. For instances with small
record sizes, I have found that the difference is trivial if not
indistinguishable, although admittedly I haven't tried to replace DataSets
with XMLDocument as such.
I do think however that overall the XMLDoc approach would have to be a whole
lot faster for me to pass up the dataset b/c DataSet's can do quite a bit
for you and maintainability of code and ease of use are not something to
take for granted. Also, I think that DataSets can do a lot in terms of data
integrity that would take a whole lot more work to do with XMLDocument.
Moreover, if speed is the primary concern, than XML may not be the way to go
at all. After all, you could use a Strongly Typed collection populated by a
DataReader and roll out your own logic and probably realize performance
gaines over both approaches.
Specifically though, it may be faster to use XMLDoc to load the data, but
Updating the DB is one of the more expensive operations in either scenario,
and provided the update logic is the same, I doubt you'd notice the
differences.
The bottom line really depends on how things are structured and the number
of records, and if speed is the primary consideration, there are probably a
lot of other things that can be done still using a DataSet to speed things
up. And remember that if you opt totally against using DataSets/DataTables
,then you are going to pass up some functionality and optimizations that you
probably don't want to pass up.
Can you post a little more about the specific situation at hand that you are
facing? I could probably get a lot more specific then.
Cheers,
Bill