OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] Eclipse: the new Emacs? (and the XML story)

[ Lists Home | Date Index | Thread Index ]

Thank you very much for the information.

The "time" data can't be interpreted without knowing what sort of 
machine ran the tests. What was it's speed, memory size, etc.?

Also, I have a question about the units. Am I correct in reading that 
the average simple Object construction time was 59ms/200000 = 0.295 
microseconds?

Re String size: Assuming all your numbers are based on Sun JVM 1.4.2, 
there is a 16-byte overhead for any array, an 8-byte overhead for an 
Object, and a String object contains size, offset and hash ints and an 
array reference, another 16 bytes. That's 40 bytes independent of the 
size of the string.  If you created the string with new String("abcd"), 
it should require 44 bytes. Don't know where the other 4 bytes are.

(If String values are associated with element and attribute nodes, they 
probably use more storage than the nodes. A compact element node 
requires only 8 bytes of overhead, 12 bytes for parent, firstChild and 
nextSibling references, and 4 bytes for a String reference, a total of 
24 bytes.)

Bob Foster

Dennis Sosnoski wrote:
 > Bob Foster wrote:
 >
 >> K. Ari Krupnikov wrote:
 >> > David Megginson <dmeggin@attglobal.net> writes:
 >> >
 >> >>Java objects have an awful lot of built-in
 >> >>memory overhead just for the java.lang.Object base class
 >> >
 >> > Do you know how much memory you actually use for a "new Object()"?
 >>
 >> Yes, a pinch of actual fact would make a nice spice for this latest
 >> round of the "objects cost too much" permathread.
 >>
 >>
 >>
 > In older JVMs (1.1.8) even a simple Object would take about 32 bytes.
 > Now that's down to 8 bytes, for the Sun JVM 1.4.2 on Linux:
 >
 > Base Object starting memory usage 884792, ending usage 2484792
 > Base Object size in bytes: 8
 > Base Object construction time in ms. for 200000 instances: 59
 > String (4 characters) starting memory usage 884952, ending usage 10484952
 > String (4 characters) size in bytes: 48
 > String (4 characters) construction time in ms. for 200000 instances: 851
 > Integer starting memory usage 884952, ending usage 4084952
 > Integer size in bytes: 16
 > Integer construction time in ms. for 200000 instances: 135
 > byte Array (0 length) starting memory usage 884952, ending usage 4084952
 > byte Array (0 length) size in bytes: 16
 > byte Array (0 length) construction time in ms. for 200000 instances: 128
 > byte Array (8 length) starting memory usage 884952, ending usage 5684952
 > byte Array (8 length) size in bytes: 24
 > byte Array (8 length) construction time in ms. for 200000 instances: 211
 > Reference Array (8 length) starting memory usage 884952, ending usage
 > 10484952
 > Reference Array (8 length) size in bytes: 48
 > Reference Array (8 length) construction time in ms. for 200000
 > instances: 628
 >
 > This is from a modified version of the code I used for a JavaWorld
 > article a few years back (the article now mostly obsolete, so I won't
 > link it). Don't know why Strings are so slow and so large (figure 24
 > bytes for the char[4], but that still leaves another 24 bytes just for
 > the String data), but it would certainly account for a lot of the bloat
 > in document models. In general, document models take about 4-8X the
 > document size in bytes (with the low end for documents that are mostly
 > text): http://www.sosnoski.com/opensrc/xmlbench/results.html#size These
 > results are a couple of years old (and from a 1.3.X JVM), but still
 > fairly accurate from what I've seen.
 >
 >  - Dennis
 >






 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS