Some stanzas (with roster for example) can contain huge amount of xml, which is all parsed into xml tree even if use_raw=True. Because of this punjab can consume large amount of RAM (possibly because of python memory fragmentation http://www.gossamer-threads.com/lists/python/python/1162114) and CPU (to create domish.Element() instances).
ShallowExpatElementStream overrides _onStartElement() and _onEndElement() methods of regular parser to avoid building whole tree, which is done by default in domish.py:ExpatElementStream.
Some stanzas (with roster for example) can contain huge amount of xml, which is all parsed into xml tree even if use_raw=True. Because of this punjab can consume large amount of RAM (possibly because of python memory fragmentation http://www.gossamer-threads.com/lists/python/python/1162114) and CPU (to create domish.Element() instances).
ShallowExpatElementStream overrides _onStartElement() and _onEndElement() methods of regular parser to avoid building whole tree, which is done by default in domish.py:ExpatElementStream.