As documented in https://saxonica.plan.io/boards/3/topics/9475?r=9566 we came across a massive performance problem when using Saxon XSLT engine. Saxon is optimized for reuse, so creation of a TransformerFactory is very slow (10 times slower as default engine bundled with OpenJDK), but the actual marshalling and unmarshalling is super fast. Unfortunately, for non-trivial contexts, JAXB-RI creates huge amounts of TransformerFactories (not just Transformers). So in the end, JAXB-RI on Saxon is hundreds of times slower than on JDK.
IMHO it is a good idea that Saxon precreates things when creating a Factory (so creating Transformers is fast) and what JAXB-RI does is, let's say, "uncommon": Creating lots of Factories (instead of just Transformers).
I did a quick test-drive which proofs that JAXB-RI on Saxon is not slow once I patched JAXB-RI to re-use the same TransformerFactory instead of creating new factories. I could provide a PR, but I wonder if there is something I am missing here? Is there a good reason to create a new factory always? Will reusing Factories (not Transformers!) break something?
As documented in https://saxonica.plan.io/boards/3/topics/9475?r=9566 we came across a massive performance problem when using Saxon XSLT engine. Saxon is optimized for reuse, so creation of a TransformerFactory is very slow (10 times slower as default engine bundled with OpenJDK), but the actual marshalling and unmarshalling is super fast. Unfortunately, for non-trivial contexts, JAXB-RI creates huge amounts of TransformerFactories (not just Transformers). So in the end, JAXB-RI on Saxon is hundreds of times slower than on JDK.
IMHO it is a good idea that Saxon precreates things when creating a Factory (so creating Transformers is fast) and what JAXB-RI does is, let's say, "uncommon": Creating lots of Factories (instead of just Transformers).
I did a quick test-drive which proofs that JAXB-RI on Saxon is not slow once I patched JAXB-RI to re-use the same TransformerFactory instead of creating new factories. I could provide a PR, but I wonder if there is something I am missing here? Is there a good reason to create a new factory always? Will reusing Factories (not Transformers!) break something?