[antlr-interest] On trees and JavaBeans, part 2: tree creation
Scott Stanchfield
scott at javadude.com
Wed Apr 20 04:34:43 PDT 2005
> > > The trouble is there are extra objects to collect. More
> objects ==
> > > more
> >
> > You miss the point.
>
> Yes he does. A TreeModel-style abstraction isn't an
> alternative to the Carrier/Payload model. It is a façade that
> allows one to use Carrier/Payload or any other model one
> cares to implement.
I assume you mean Loring missed the point? Sometimes the indentation is
weird...
This is exactly what I propose. Make the code that walks the carrier/payload
combo implement ASTModel as the DefaultASTModel in ANTLR.
That allows folks to use carrier/payload if they want, or completely replace
the carrier/payload system with their own tree navigation.
> > There is less manipulation of data
> > pointers with Payloads implemented as objects distinct from
> Carriers
> > when doing significant manipulations. Objects created and
> destroyed
> > are homogeneous, which places less stress on the garbage collector
> > resulting in faster creation times and fewer compactions. And, for
> > platforms that do not have efficient garbage collectors, releasing
> > Carriers back to a CarrierFactory is possible.
>
> Indeed.
But not necessary.
Pooling is nice, but adds a *ton* of complexity and potential bugs
(especially b/c it's way too easy to forget to release loaned objects,
resulting in a leak...)
Its much better to not have to create those extra unnecessary objects in
the first place.
Later,
-- Scott
More information about the antlr-interest
mailing list