improve peformance of composite encoding/decoding