Optimize performance of serialization routines