Improved col encoding performance and reduces memory use