fritzy/SleekXMPP — pull request #116 by vijayp (2011-11-20 00:12:23+00:00)
Title: elide copies

There a lot of places where stanzas are copied. this is a pretty expensive operation (deepcopy is often used), and should be avoided whenever possible.

Ideally, event handlers should not be permitted to modify data passed in, but that will require a change in RPC. An additional way to do this would be to write a COW data wrapper, but that is a lot of work, and too ugly.

I solved the issue by not doing any copying when there is only one matching handler when the data is not used after the handler executes, and also eliminating unnecessary/duplicated copies.

This passes all unittests.