Sometimes the fastest way to parse a known XML stream is to write your own lean parser. Even in Ruby, this gives remarkable performance benefits.
Most programming languages have their own XML parser libraries. And many of those use the DOM (Document Object Model) API. DOM is good for general-purpose XML processing: The input is parsed into a tree structure that can be modified and written back out. Often whitespace is preserved so the output is identical to the input if it is not modified. This generality comes at a cost: large memory requirements (often more than double the input size) and slow read and write. For applications that read the XML data for only specific pieces of information, there are better alternatives.
Full post on Dr Dobb's