Thank you for your fast response.

If you have a lot of namespaces then I can easily believe
you :) I did not run performance benchmarks but probably
the simplest way to optimize it is to change from a linear search
for a matching namespace to a simple binary search. I would
bet it will give you pretty nice speedup. Next, you can try to
cache search results (i.e. for nodes on the same level).

No, we tested it with a large xml document (around 300kb) with a nested level around 20 or more (because of embeded xslt display transform inside document). But not a lot namespaces. The problem is that you are searching for namespaces to the parent node (for each node you go to the parent exactly level of the current node times (xmlSearchNS is also doing it) (instead of one time or zero if stored inside ns_rendered)).

<a xmlns="bla">
   <b>
       <c>
           <d> -> currently processing namespaces for this node
the problem I see is here ==> you check for node "a" namespaces exactly 4 times ... for "b" 3 times and for "c" two times ... now if xml depth is 20 ... and that is only for node d.

Suggestion:
-> getting rid of xmlSearchNS
-> creating a ns list when going ONE time to the parent
-> iterating through the list (checking for visible, etc etc) and adding it to the output list

Will try to test this solution on top of namespace::* one and will get back to you later.

Thanks,
Matej Spiller-Muys

_______________________________________________
xmlsec mailing list
[email protected]
http://www.aleksey.com/mailman/listinfo/xmlsec

Reply via email to