Hi Sean,

Thanks for your response. My code basically is what you've suggested. I use
static initialisers & load the templates in the static block. It seems to be
doing it at server startup because of the log messages that gets printed out
& also by the fact that the templates do get used (doesn't look like it is
creating new ones) when the PDF document is generated. BUT the PDF
generation is still slower the first time the xsl style sheets are being
used.

I am thinking of trying out the XSLT compiler as pointed out in 
http://xmlgraphics.apache.org/fop/0.95/embedding.html#performance

My concern is the comment:

Although the XSLTC developers make every effort to avoid changes that affect
binary compatibility, we cannot guarantee that a translet will work with any
version of the run-time processor other than the one that corresponds to the
version of the XSLTC compiler that was used to create the translet.

in the description on whether any upgrade of java version would have any
impact? or would it be just the version of the XSLT compiler?

Cheers,



Griffin,Sean wrote:
> 
> Tamu,
> Based simply on the code sample that Brian provided in his original post
> over a year ago, the XSL will only be "compiled" when the class containing
> that static initializer is loaded.  That class won't be loaded until it's
> used, so your first run is always going to include both compilation and
> transformation time while subsequent runs will just include
> transformation.  Couple that with the fact that even after compilation
> there is undoubtedly other caching and potential class loading going on by
> both the JVM and OS when you do the first transformation.  And finally,
> Brian's original post coupled the XSLT transformation with the FOP
> rendering; these are separate processes and FOP does not control how you
> use the XSLT to get to the XSL-FO it needs.
> 
> Assuming your code is like Brian's, it's doing what it's supposed to do
> (though I personally don't like static initializers myself because of the
> exception-eating that goes on if there's an error in the stylesheet that
> causes it to not compile).  If you want to perform the stylesheet
> compilation before the first run you need to put it in a method that gets
> called from the lifecycle hooks in your application.  Assuming this is in
> a web application, you can do it in the
> ServletContextListener.contextInitialized method.
> 
> Sean
> 
> -----Original Message-----
> From: tamugrg [mailto:sagun.gur...@auspost.com.au] 
> Sent: Friday, January 22, 2010 6:34 AM
> To: fop-users@xmlgraphics.apache.org
> Subject: RE: XSL caching question
> 
> 
> Hi,
> 
> I am facing exactly the same issue. The first time the XSL gets used, it
> takes quite a bit of time to do the transformation. After that the
> transformations happen much faster. I am using templates as described in
> this thread & assume the style sheet should be cached. But from the
> behaviour that it takes longer the first time the XSLs are being used &
> subsequently takes lesser time indicates that probably it's not been
> catched.
> 
> Any suggestions/experience on this is very much appreciated.
> 
> Cheers,
> tamu
> 
> 
> 
> Brian Trezise wrote:
>> 
>> Silly me, going to be hard for you guys to answer my question if you
>> don't
>> have a code sample to look at J
>> 
>> 
>> 
>> 
>>    static
>> 
>>    {
>> 
>>       try
>> 
>>       {
>> 
>>          cyberTron = TransformerFactory.newInstance();
>> 
>>          Config config = (Config)
>> ConfigManager.getInstance().getConfig(Config.class);
>> 
>>          Source xslt = new StreamSource(new
>> File(config.getXSLTemplateURL()));
>> 
>>          allSpark = cyberTron.newTemplates(xslt);
>> 
>>       }
>> 
>>       catch(Exception e)
>> 
>>       {
>> 
>>          logger.error(e);
>> 
>>       }
>> 
>>    }
>> 
>>  
>> 
>> ~Brian
>> 
>> ___________________________________________________
>> Brian Trezise
>> Staff Software Engineer
>> IntelliData, Inc
>> 22288 E Princeton Dr
>> aurora, colorado 80018
>> T: 720.524.4864
>> brian.trez...@intellidata.net
>> 
>>  
>> 
>> From: Brian Trezise [mailto:brian.trez...@intellidata.net] 
>> Sent: Monday, August 25, 2008 2:41 PM
>> To: fop-users@xmlgraphics.apache.org
>> Subject: XSL caching question
>> 
>>  
>> 
>> In FOP 0.95, I'm using the basic caching method to cache my XSL
>> transformation file, not doing anything fancy with file system monitors
>> or
>> anything for the time being.  The first time I run FOP on the server to
>> generate a pdf, it takes 10-20 seconds to generate the pdf because it's
>> loading up the XSL file for the first run.  Afterwards it runs in the
>> neighborhood of 500ms per PDF.  I was just wondering if there is a way to
>> force the XSL to fully cache statically?
>> 
>> This isn't a huge issue as we don't restart our servers all that often
>> but
>> it's just a little thing that's bugging me J
>> 
>> Thanks,
>> 
>> ___________________________________________________
>> Brian Trezise
>> Staff Software Engineer
>> IntelliData, Inc
>> 22288 E Princeton Dr
>> aurora, colorado 80018
>> T: 720.524.4864
>> brian.trez...@intellidata.net
>> 
>>  
>> 
>> 
>> 
> 
> -- 
> View this message in context:
> http://old.nabble.com/XSL-caching-question-tp19151328p27272536.html
> Sent from the FOP - Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org
> 
> ----------------------------------------------------------------------
> CONFIDENTIALITY NOTICE This message and any included attachments are from
> Cerner Corporation and are intended only for the addressee. The
> information contained in this message is confidential and may constitute
> inside or non-public information under international, federal, or state
> securities laws. Unauthorized forwarding, printing, copying, distribution,
> or use of such information is strictly prohibited and may be unlawful. If
> you are not the addressee, please promptly delete this message and notify
> the sender of the delivery error by e-mail or you may call Cerner's
> corporate offices in Kansas City, Missouri, U.S.A at (+1) (816)221-1024.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/XSL-caching-question-tp19151328p27300720.html
Sent from the FOP - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org

Reply via email to