optimize char size calculation