Hi Egor,

  First of all sorry for not answering your request sooner. Regarding
your problem, it seems that the way we transform the stream to UTF8 in
1.2(the library do the conversion itself) is slower in your case to
the way it was done 1.1(we use classes given by the SDK). This is
weird because, I made a lot of test regarding it and was always faster
doing in the library that letting the work for the API. I will
investigate this a little more, but IŽll need more information
regarding your runtime: What JRE are you using, in what OS, in what
locale, and of course are you testing with JIT enable(i.e. are you
using -server or -client).

Regards,

Raul
http://r-bg.com

On Tue, 11 Jan 2005 18:38:40 +0500, Egor Pervuninski <[EMAIL PROTECTED]> wrote:
> Hello,
> 
> Sure, here it is.
> 
> ## Davanum Srinivas : Tue, 11 Jan 2005 08:28:24 -0500
> 
> DS>  Can you please post your test.xml as well?  thanks, dims
> DS>
> DS> On Tue, 11 Jan 2005 18:31:18 +0500, Egor Pervuninski
> DS> <[EMAIL PROTECTED]> wrote:
> >> Hello,
> >>
> >> Recently I tried to upgrade my project to use new Apache XML
> >> Security 1.2 for Java and found that now the library does c14n much
> >> MUCH more slowly than it was with 1.1.
> >>
> >> Here is a simple test:
> >>
> >> import javax.xml.parsers.DocumentBuilder; import
> >> javax.xml.parsers.DocumentBuilderFactory;
> >>
> >> import org.apache.commons.lang.time.StopWatch; import
> >> org.apache.xml.security.c14n.Canonicalizer; import
> >> org.w3c.dom.Document; import org.xml.sax.InputSource;
> >>
> >> public class Test { private final static int REPEAT = 1000;
> >>
> >> private StopWatch timer = new StopWatch(); private Canonicalizer
> >> canon =
> >> Canonicalizer.getInstance(Canonicalizer.ALGO_ID_C14N_OMIT_COMMENTS);
> >> private Document document;
> >>
> >> public Test(String file) throws Exception { DocumentBuilderFactory
> >> factory = DocumentBuilderFactory.newInstance();
> >> factory.setNamespaceAware(true); factory.setValidating(false);
> >> DocumentBuilder builder = factory.newDocumentBuilder(); document =
> >> builder.parse(new InputSource(file)); }
> >>
> >> public void runTest() throws Exception { timer.start(); for (int i
> >> = 0; i < REPEAT; i++) { canon.canonicalizeSubtree(document); }
> >> timer.stop(); System.out.println("time spent " +
> >> String.valueOf(timer.getTime()) + " ms"); }
> >>
> >> public static void main(String[] args) throws Exception {
> >> org.apache.xml.security.Init.init(); Test test = new Test(args[0]);
> >> test.runTest(); } }
> >>
> >> Just drop commons-lang-2.0.jar, commons-logging.jar,
> >> xercesImpl.jar, xml-apis.jar and xmlsec.jarto the classpath and run
> >> java Test File.xml.
> >>
> >> Version 1.1 output: time spent 952 ms Version 1.2 output: time
> >> spent 29172 ms
> >>
> >> Where is the catch?
> >>
> >> Regards, Egor Pervuninski egor {dot} pervuninski {at} gmail {dot}
> >> com
> >> 
> DS> --
> DS> Davanum Srinivas - http://webservices.apache.org/~dims/
> DS>
> 
> Regards,
> Egor Pervuninski
> egor {dot} pervuninski {at} gmail {dot} com
> 
> 
>

Reply via email to