improve o2-encode/decode to achieve better performance.