Re: how to store list of varying types
- From: "Tom Serface" <tom.nospam@xxxxxxxxxxxxx>
- Date: Tue, 1 Jul 2008 07:27:51 -0700
Hi G,
I can't argue with your points, but I'd have to do some testing to agree with the idea that it is that much more efficient. Perhaps if OP is writing a ton of data, but I've written out files with over 100K significantly appointed XML records in about 5 seconds.
You are right that a parser to read the file is more trouble (unless you consider the format to be very rigid), but writing XML is trivial and can be done with CStdioFile WriteStrings() with a little CString formatting.
It's nice to have different options though. So long as none of the options is using the built in Serialize stuff. I avoid that these days at all costs. Too difficult to maintain across version (of course tagged binary has the same problem of versioning. If I were to use Joe's example, I'd add a header record with some information about the version.
Tom
"Giovanni Dicanio" <giovanni.dicanio@xxxxxxxxxxx> wrote in message news:%234XQQj12IHA.2348@xxxxxxxxxxxxxxxxxxxxxxx
"Tom Serface" <tom.nospam@xxxxxxxxxxxxx> ha scritto nel messaggio news:C3E60DCF-F8DD-4379-A9E6-830380189A5E@xxxxxxxxxxxxxxxx
Why not just write out real XML? It makes it easier to test, read, and even modify outside your program. You'd need a special routine to read either type of file.
Hi Tom,
I agree with you that "real XML" is easier to test, read and modify, being a text-based clear format.
However, I think that the main advantage of "tagged binary" [*] over "real XML" is *efficiency*.
In fact, I believe that reading and writing (especially reading) in "tagged binary" is much faster and consumes less memory than real XML.
(for example, in real XML you have to escape characters like < > &, etc. parsing work is much more complicated, etc.
To manage XML it is better to use an external parser like TinyXML or XMLLite, the latter being COM based, so not very easy... instead it is trivial to write some C/C++ code to manage "tagged binary".)
[*] I used "tagged binary" in several times, I think it is very intuitive to think about a format like that. I just did not know that name :)
Giovanni
.
- Follow-Ups:
- Re: how to store list of varying types
- From: Giovanni Dicanio
- Re: how to store list of varying types
- References:
- Re: how to store list of varying types
- From: Tom Serface
- Re: how to store list of varying types
- From: Giovanni Dicanio
- Re: how to store list of varying types
- Prev by Date: Re: how to store list of varying types
- Next by Date: Re: Folderselector dialog problems.
- Previous by thread: Re: how to store list of varying types
- Next by thread: Re: how to store list of varying types
- Index(es):
Relevant Pages
|