Optimize the performance of ParseKeyValues