[jdom-interest] JDOM Document size

Matthew MacKenzie matt at xmlglobal.com
Thu Feb 8 18:20:27 PST 2001


It might be possible to guage the size of a DOM rather unscientifically by
first running the program with a very simple xml file, such as <doc />,
recording the
memory footprint, then running a more complex document with a wide variety
of components
(attributes, elements, cdata, etceteras) and also recording its process
size.  Subtract a from b and
you should have a really rough estimate.

$ man top

:-)


--
Matthew MacKenzie
VP Research & Development
XML Global Technologies, Inc.

-----Original Message-----
From: jdom-interest-admin at jdom.org
[mailto:jdom-interest-admin at jdom.org]On Behalf Of Jason Hunter
Sent: February 7, 2001 6:29 PM
To: quasar at b0b.com
Cc: jdom-interest at jdom.org
Subject: Re: [jdom-interest] JDOM Document size


> I was faced with a similar problem.  Instead of caching the JDOM
Document, I
> opted to read it into a serializable Java class.  This worked very well
and
> is very fast.  The resulting bean is smaller than the source XML.

It's tricky to judge how much memory a document takes.  It's a feature I
wish OptimizeIt had.  I suspect that the size of a serialized Document
object would be rougly equivalent to its size in memory.  Anyone know
for sure how closely they relate, or have a good trick for judging the
memory usage of an object and its members?

BTW, it's theoretically possible for a serialized document to be smaller
when serialized than in its original XML source, because long strings
like "this_long_element_name" are intern'd and thus need only be
represented once in the output.  Plus if your file encoding is UCS-2
you'll save because serialization presumably uses UTF-8.  I'm not saying
I expect serialization will be smaller, but that it's possible.

-jh-
_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourh
ost.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 2879 bytes
Desc: not available
Url : http://jdom.org/pipermail/jdom-interest/attachments/20010208/28e17097/smime.bin


More information about the jdom-interest mailing list