[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

XML Memory Requirements (was Re: Feeling good about SML)

  • From: David Megginson <david@m...>
  • To: <xml-dev@i...>
  • Date: 17 Nov 1999 17:55:21 -0500

xml memory
"Don Park" <donpark@d...> writes:

> Still worried I am afraid because it is not just the
> size of the parser and applications but how much memory
> they need to run.  While I am not expecting the size and
> speed differences to exceed 50%

Here are the significant dynamic memory requirements for a conformant,
non-validating XML 1.0 processor that uses an event-based interface:

a) a dynamic buffer for reading names -- its maximum length will be
   the length of the longest name (element name, attribute name, or PI
   target) in the document;

b) a buffer for reading a chunk of data or an attribute value (with
   SAX, its maximum length will be the length of the longest attribute
   value in the document);

c) a stack of the names of currently-open elements so that you can
   match start/end tags; its maximum size will be the depth of
   element nesting in the document (usually under 20 in my
   experience);

d) a map of declared default attribute values;

e) an array of attribute names seen while each start tag is being
   processed (it can be freed as soon as the start-element event has
   been reported); its maximum size will be the greatest number of
   attributes (defaulted and specified) for a single element (usually
   under 10 in my experience, maybe 20 with TEI);

f) a whole bunch of big tables or sets of start/end values for
   checking which Unicode characters are allowed in which contexts;
   and

g) a stack or state variable keeping track of what's currently being
   parsed (i.e. "in comment" or "looking for name").

Note that supporting PIs and comments doesn't really add anything to
the memory requirements, since you can use the same buffers that you
use to read names and character data.

If SML eliminated attributes altogether, you could make (b) a little
shorter (say, 512 characters max), though few documents have attribute
values longer than 512 characters and you could eliminate (d), which
might save 2K or so, and (e) which might save another 1K or so for a
document that really beats up on attributes, but you'd have to add a
bit to (c) for the new elements required to replace the attributes --
let's say, then a 3K saving in memory consumption for processing a
large document if attributes are forbidden.

>, every little bit counts
> so it is a matter of benefit/sacrifice ratio.  Note that
> I also do not believe this is the primary justification
> for SML.

Good, because unless I've missed something obvious, a 3KB memory
saving probably lands on the wrong side of that ratio.

Again, the big problem in creating a tiny XML processor is the
required error reporting for illegal characters in names, attribute
values, etc. -- if you build lookup tables, you're looking at an
enormous amount of memory for each table.


All the best,


David

-- 
David Megginson                 david@m...
           http://www.megginson.com/

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i...
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:majordomo@i... the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo@i... the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@i...)



PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.