improve serialize performance