Performance improvements

Reduced amount of autorelease pools and reduced amount of byte copies where possible