I think generally, you're seeing the cloning coming from the iterators.
Each iterator (for instance "foo/baz" would create an iterator) holds it's
own state, and therefore has to be cloned.  We've tried things like object
pooling to decrease the cloning, but it's really not cheaper than cloning.
We've also done some things to decrease when you need a full clone... for
instance <xsl:value-of select="foo/baz"/> only finds the first object, so
should only need one instance per process.  But you still have to reset the
iterator each time.

Using the iterator model gives Xalan it's incremental processing
characteristics.  The other model is to just use vectors, and create a
vector every time, but then you have to find all the nodes at once.  This
is what XalanJ 1.x did.  Besides killing incrementality, you'll find you
spend an similar amount of time (well, maybe half) creating vector objects.

A fully compiled model (XSLTC) can probably decrease the amount of cloning
needed for the iterator model by a lot (75%?).

You might try the most recent version of CVS, and see how your profile
changes.  We've done a fair amount of performance tuning in the last couple
of months, including redundent expression elimination, and some elimination
of cloning, which may help you a lot.  We've still got a couple of bugs to
kill before we do a release (and I've been too busy lately to do a
developer's release myself).

-scott




                                                                                
                                                       
                      Bryan Kearney                                             
                                                       
                      <[EMAIL PROTECTED]        To:       "'[EMAIL PROTECTED]'" 
<[EMAIL PROTECTED]>               
                      .com>                    cc:       (bcc: Scott 
Boag/Cambridge/IBM)                                               
                                               Subject:  What causes object 
cloneing?                                                  
                      05/28/2002 09:50                                          
                                                       
                      AM                                                        
                                                       
                                                                                
                                                       
                                                                                
                                                       




I am profiling xalan j 2.3.1 and I have noticed that 20+% of my time is
spent in Object.clone(). Given that my CPU is pegged with 5 concurrent
transformations, I am guessing that the heap allocation, and therefore the
cloneing, is causing most of the pain. What in the stylesheets causes a
clone?

Thanks in advance.

-- bk





Reply via email to