codecs: try to reuse buffers in pack_string
codecs: create fewer small strings during unpacking