Eran Chinthaka wrote:

start with no collection and allocate collection only if any attribute
is added and have initial size 1 or 2 with increment of 4.



[Chinthaka] This is what I also have done. Initially there is no collection and if there is an attribute only I create the ArrayList.


I just looked in to the JDom way of implementing Namespaces and Attributes.
As far as the namespaces are concerned they have done the same thing, we
did. They have an ArrayList of 5 to hold namespaces, within the Element.


i would guess that if you have 4 or more elements than ArrayList is more efficient than any linked list implementation
linked list: N * (size of object) + 2 * N * (size of pointer for next/prev)
array list: N * (size of object) + size filed + N * (size of pointer - actual array)
and access is faster as you can read directly elements form array no need to walk linked list to find elements


however without tests i could not say and moreover i think when compared to other operations in OM or in Engine this will be unnoticeable

alek

And the same mechanism is there for attributes, but with some more
complexity. So I think our approach is not so bad. And I know very well that, JDom is
very good in performance wise also, as I used JDom to bench mark our OM.


So my opinion is to leave the things as it is, until we find some better way
of implementing that.


Thankx and regards, -- Eran Chinthaka






--
The best way to predict the future is to invent it - Alan Kay



Reply via email to