[
Lists Home |
Date Index |
Thread Index
]
8/14/2002 10:24:23 AM, "Dare Obasanjo" <dareo@microsoft.com> wrote:
>One is sending an XML string once while the other is sending multiple custom messages corresponding to the number of SAX
parse events in XML string you are parsing. One is straightforward the other is convoluted. One is relatively quick, the
other is slow as molasses. One is...
>
>You get the point.
Most of you probably write a lot more code than I do these days, so forgive this brief pontification: I'm not sure about
Roger Costello's situation, but there may be a general "antipattern" that assumes a priori that the overhead of XML text
parsing is a significant bottleneck and goes to great lengths to preserve the parsed representation somehow. Of
course, you'll just have to profile your own applications to figure this out, but I know I have wasted months trying to
figure out how to avoid the "inefficiency" of parsing XML data multiple times as it flowed between different modules of a
system. Subsequent analysis showed the overhead of parsing the XML to be roughly similar to the overhead of converting
binary data structures back and forth, and sending the text around greatly simplified the architecture.
I've heard variations on this story often enough to think that it *is* a fairly general rule of thumb: XML is not that
hard to parse, the folks at Microsoft, Apache, or wherever have worked hard on optimizing their parsers, and you're not
likely to beat their code with a quickly designed binary format. At least *profile* a text-based prototype using off-
the-shelf parsers before you conclude that the parse time is a significant bottleneck in your app that needs to be
optimized.
|