For a long time, we have considered the use of XMLSearch slow compared to working through an xml object as a standard ColdFusion structure. However, recently we have discovered that XMLSearch is actually comparable in speed to the structured approach and it was just our way of using it that was causing the slowdowns.
It turns out that that we were using the “//” XPath operator at the beginning of our calls to XMLSearch regardless of where the XMLDoc object that we were supplying was pointing to. This would cause the search function to go to the root of the document and search the whole tree. Removing the “//” operator from the XPath portion of the call forces ColdFusion to start at where the XMLDoc actually is and drastically reduces the processing time.