Faster version of calculating size, min and max values for categories