Optimizations

Here you have a few optimizations as I described on my email to the proton-list:

http://qpid.2158936.n2.nabble.com/Optimizations-on-Proton-j-td7607577.html