> -----Original Message-----
> From: Oleg Tkachenko [mailto:[EMAIL PROTECTED]]
> Sent: August 12, 2002 8:16 PM
> To: [EMAIL PROTECTED]
> Subject: just a thought
>
> It's probably not too late to consider some trivial optimization of fo
> tree in redesign code. In a typical fo document probably about 30% of
> elements have no children or have only one child (text node usually), so
> instead of eager
> protected ArrayList children = new ArrayList();
> in FObj.java we can consider lazy polymorphic member
> protected Object children = null;
> 1) For no chidren case it remains to be null.
> 2) For 1 child case it is FONode object.
> 3) For children case it is ArrayList.
> This means some additional logic must be implmented at addChild() and
> getChildren() methods.
>
> Any thoughts?

Seems reasonable to me, Oleg. The default constructor for ArrayList creates
an array of 10 Objects. An inexpensive check for null in addChild() is
unlikely to cost more, even over many children, especially averaged over an
entire document.

Case 2 might be overkill, unless one can make the case that single children
are frequent enough to make this extra logic worthwhile. Comments?

Regards,
Arved


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to