Add computation of expected size in optimized versions.