One of the problems identified in Cocoon is the use of a great number of
pooled components. The complaint being that Cocoon is pooled to death.
Something that I ran into with a Swing based app that surprised me was
the difference between reusing a JComponent object and changing its
parameters vs creating a new one for each cell in a table. The thing is
that reusing that component resulted in a tremendous performance gain
(20x). Something to realize here is that the Flyweight pattern IS NOT
POOLING. You have a set of objects that have the most expensive part
already done, and you reuse those objects reconfiguring as needed.
It got me to thinking if this could be done for Cocoon with similar
results. The part that might make it more difficult is the transformer.
Perhaps if we used the ThreadLocal object to keep the max number of
transformers that would would need to use for any one thread and then
configured them by reusing those instances we could cut down on the
number of transformers/generators/serializers needed.
The per-thread approach would work as long as there is a guarantee of
one thread per request--which seems to be valid for the current crop of
servlet engines.
- Re: [RT] Flyweight for Cocoon? Berin Loritsch
- Re: [RT] Flyweight for Cocoon? Pier Fumagalli
- Re: [RT] Flyweight for Cocoon? Nicola Ken Barozzi
- Re: [RT] Flyweight for Cocoon? Berin Loritsch
