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

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: attribute order (RE: Syntax Sugar and XML informationmodels)



"Simon St.Laurent" wrote:
 
> It is possible, but is it optimal?  I suspect the HashMap takes more
> overhead than the array, though I could be wrong about that.

[Waving hands randomly] 

Depends on your hashing implementation and then the bucket handling (ie
making sure the map is big enough in the first place to support all the
attributes without having to re-hash). As most parsers are likely to use
the standard java.util.HashMap, then probably not as it's impl isn't the
worlds best. 

If the code just used an array list, I'm not sure that it would be any
better than a HashMap either. *If* the hashmap used just string
name/value pairs there is less object allocation overhead than having to
create an Attribute object representation for each item. Object
allocation is expensive compared to inserts and possible rehash of the
map. From the SAX perspective, it really depends on whether the
Attributes class implements the holders of information as separate
arrays for each item to be kept (type, name, value etc) or uses a
lighweight container class.

-- 
Justin Couch                         http://www.vlc.com.au/~justin/
Freelance Java Consultant                  http://www.yumetech.com/
Author, Java 3D FAQ Maintainer                  http://www.j3d.org/
-------------------------------------------------------------------
"Humanism is dead. Animals think, feel; so do machines now.
Neither man nor woman is the measure of all things. Every organism
processes data according to its domain, its environment; you, with
all your brains, would be useless in a mouse's universe..."
                                              - Greg Bear, Slant
-------------------------------------------------------------------