[EMAIL PROTECTED] wrote:

Thank you for including the code, it was a great honour.

I'm currently working in other optimization, again in Transforms class, it
seems that this class is invoked a lot(I´m optimizing a Liberty
implementation, not based in opensaml, for Ericsson). The method is:public Transform item(int i) is called 68 times and consumes about 1.5sec of 2.3ms of all the sign methods.It seems it could take much less time. I will see if change it to dom can
improve the signing.
I think i will have it ready for this afternoon(spain time about 20:00GMT).


In case can be also included in the 1.1 release.

Regards,




Here is the promised patch it makes item method to go from 1.5sec to 20ms, It's not as big speed-up us the other ones but is still significative.


Index: Transforms.java
===================================================================
RCS file: /home/cvspublic/xml-security/src/org/apache/xml/security/transforms/Transforms.java,v
retrieving revision 1.14
diff -u -r1.14 Transforms.java
--- Transforms.java 14 Apr 2004 21:38:44 -0000 1.14
+++ Transforms.java 15 Apr 2004 15:32:29 -0000
@@ -281,23 +281,20 @@
*/
public Transform item(int i) throws TransformationException {


- try {
- Element nscontext = XMLUtils.createDSctx(this._doc, "ds",
- Constants.SignatureSpecNS);
- Element transformElem =
- (Element) XPathAPI.selectSingleNode(this._constructionElement,
- "./ds:"
- + Constants._TAG_TRANSFORM
- + "[" + (i + 1) + "]",
- nscontext);
-
- if (transformElem == null) {
- return null;
- } else {
- return new Transform(transformElem, this._baseURI);
- }
- } catch (TransformerException ex) {
- throw new TransformationException("empty", ex);
+ try {
+ Node sibling= this._constructionElement.getFirstChild();
+ while (sibling!=null) {
+ if ("Transform".equals(sibling.getLocalName())
+ && Constants.SignatureSpecNS.equals(sibling.getNamespaceURI())) {
+ if (i==0){
+ return new Transform((Element)sibling, this._baseURI);
+ }
+ i--;
+ }
+ sibling=sibling.getNextSibling();
+ }
+ return null;
+


      } catch (XMLSecurityException ex) {
         throw new TransformationException("empty", ex);
      }



Reply via email to